Try to automate migrations.

This commit is contained in:
Martin Mahner 2019-12-07 12:21:04 +01:00
parent e3d4725e52
commit f86f298a03
3 changed files with 11 additions and 2 deletions

View file

@ -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}

View file

@ -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:

View file

@ -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