diff --git a/Dockerfile b/Dockerfile index a746128..a17bce6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,6 +56,6 @@ RUN ./manage.py collectstatic --noinput # By default run it with pyuwsgi, which is a great production ready # server. For development, docker-compose will override it to use the # regular Django runserver. -CMD ./manage.py pyuwsgi --http=:${PORT} --logger file:/var/log/uwsgi.log +CMD ./manage.py migrate --noinput && ./manage.py pyuwsgi --http=:${PORT} --logger file:/var/log/uwsgi.log EXPOSE ${PORT} diff --git a/docker-compose.yml b/docker-compose.yml index 6c3ee36..6206af1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,6 +36,14 @@ services: - "8000:8000" command: ./manage.py runserver 0:8000 + migration: + image: app + command: ./manage.py migrate --noinput + volumes: + - .:/app:delegated + - data_db:/db + + volumes: data_db: data_collectstatic: diff --git a/dpaste/settings/base.py b/dpaste/settings/base.py index 9c7bdae..3e883e5 100644 --- a/dpaste/settings/base.py +++ b/dpaste/settings/base.py @@ -89,6 +89,7 @@ INSTALLED_APPS = [ "dpaste.apps.dpasteAppConfig", ] +sys.stdout.write(f"🐘 Database URL is: {env('DATABASE_URL')}") DATABASES = { "default": dj_database_url.config(default="sqlite:///dpaste.sqlite") } @@ -102,7 +103,7 @@ DATABASES = { try: import django_webserver INSTALLED_APPS.append('django_webserver') - sys.stdout.write(f'🚀 Production webserver installed. Will run on port {env("PORT")}') + sys.stdout.write(f'🚀 Production webserver installed. Will run on port {env("PORT")}\n\n') except ImportError: pass