diff --git a/django/anthology/settings/__init__.py b/django/anthology/settings/__init__.py index 527ac0a1313f038a72c4502c85e0a009f185f41a..ce5186851004b68c891894bc62245897ee420399 100644 --- a/django/anthology/settings/__init__.py +++ b/django/anthology/settings/__init__.py @@ -62,11 +62,6 @@ TEMPLATES = [ }, } ] -STATIC_URL = "web/static/" - -# STATIC_ROOT = 'static' - -STATICFILES_DIRS = [BASE_DIR / "static"] WSGI_APPLICATION = "anthology.wsgi.application" @@ -133,12 +128,6 @@ USE_L10N = True USE_TZ = True - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/3.0/howto/static-files/ - -STATIC_URL = "/static/" - AUTH_USER_MODEL = "meleager_user.User" CACHES = { diff --git a/django/anthology/settings/prod.py b/django/anthology/settings/prod.py index ac1d671e70f1ea085bfc002cc11a97c11b35a65d..9bf5c43b10c9acc3fb5564fca20f24509e6abda3 100644 --- a/django/anthology/settings/prod.py +++ b/django/anthology/settings/prod.py @@ -1,3 +1,9 @@ from .antholont import * +ALLOWED_HOSTS = ["prod-ap.ecrituresnumeriques.ca", "anthologiagraeca.org"] + +STATIC_URL = '/static/' +STATIC_ROOT = '/static' +# STATICFILES_DIRS = [BASE_DIR / "static"] + SECRET_KEY="|WA82LPB9NOKQSk*XJu0^B(+bi^Uih?6vt><PE!*fXz3&mVkw=q*^^)X3Xz_<*!U5.X%mdT}^BZ;8(c~w%YNv5 k?3wQ HK/W+nW~E8R3}^meSO}@L:y?pa5vyA z+ha" \ No newline at end of file diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 18e6481f2b3185c9f0ac2de5478067e618fff444..08d1a9b6d12c6bb8816612f8deaa323bc896a035 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -2,11 +2,11 @@ version: '3.1' services: db: - container_name: ap_db + container_name: ap_db_prd image: mdillon/postgis restart: always volumes: - - ./initdb:/docker-entrypoint-initdb.d + - ./src/initdb:/docker-entrypoint-initdb.d - ./persistent_db:/var/lib/postgresql networks: - default @@ -15,31 +15,37 @@ services: POSTGRES_USER: anthology_django POSTGRES_PASSWORD: password http: - container_name: ap_http + container_name: ap_http_prd restart: always image: nginx + depends_on: + - app volumes: - - ./docker/nginx.conf:/etc/nginx/conf.d/default.conf + - ./src/docker/nginx.conf:/etc/nginx/conf.d/default.conf + - ap_static:/static networks: - default - traefik labels: - 'traefik.enable=true' - - 'traefik.backend=ap_http' + - 'traefik.backend=ap_http_prd' - 'traefik.port=80' - 'traefik.docker.network=traefik_net' - 'traefik.frontend.rule=Host:prod-ap.ecrituresnumeriques.ca' app: - container_name: ap_python + container_name: ap_python_prd restart: always image: timoguic/antholont:stable - environment: - - DJANGO_SETTINGS_MODULE=anthology.settings.prod + volumes: + - ap_static:/static depends_on: - db networks: - default +volumes: + ap_static: + networks: default: driver: diff --git a/docker/base/Dockerfile.base b/docker/base/Dockerfile.base index 2229d397c9b6c067ac9b567b6447994fde4b55cb..81885c7749b1da4808dfb22b230b1fc1633789e0 100644 --- a/docker/base/Dockerfile.base +++ b/docker/base/Dockerfile.base @@ -8,5 +8,4 @@ COPY requirements.txt /requirements.txt RUN python -m pip install -r /requirements.txt RUN mkdir -p /import && chmod -R 777 /import && mkdir /code -WORKDIR /code -VOLUME /code \ No newline at end of file +WORKDIR /code \ No newline at end of file diff --git a/docker/nginx.conf b/docker/nginx.conf index 1ee5e2249015e580f7b3b827e6f6e6a7a77921f8..362ce4e8e9bbb341781e0d112d48e8b462266d37 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -7,8 +7,13 @@ server { #access_log /var/log/nginx/host.access.log main; location / { - root /usr/share/nginx/html; - index index.html index.htm; + proxy_pass http://app:8000; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $remote_addr; + } + + location /static { + alias /static; } location /docs { diff --git a/docker/start_antholont.sh b/docker/start_antholont.sh index 0f82a03b18e19c6000d5124826dec3b06a66871f..5f5dda69f7f945505d2ffdeda998bbf2e63b0c86 100644 --- a/docker/start_antholont.sh +++ b/docker/start_antholont.sh @@ -2,5 +2,6 @@ set -ex cd /code python manage.py migrate -python manage.py compilemessages +python manage.py compilemessages --noinput +python manage.py collectstatic --noinput python -m gunicorn -b 0.0.0.0:8000 anthology.wsgi \ No newline at end of file