run django with gunicorn

This commit is contained in:
Andreas Zweili 2019-08-11 18:37:37 +02:00
parent 32df8c464e
commit 521aaef946
3 changed files with 16 additions and 1 deletions

View File

@ -5,7 +5,7 @@ ALLOWED_HOSTS = [
]
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'kzx(i9^@*g^cgp(_3052%*1d%zyu^2z_@pgso5!_q@jb-j%4m='
SECRET_KEY = os.getenv('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

14
production.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
cd network_inventory
if [ -f ./.second_run ]; then
python manage.py makemigrations
python manage.py migrate
else
python manage.py makemigrations
python manage.py migrate
python manage.py loaddata inventory
python manage.py shell -c "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', 'admin@example.com', 'password')"
touch .second_run
fi
gunicorn network_inventory.wsgi:application --bind 0.0.0.0:8000 --workers 3

View File

@ -1,3 +1,4 @@
-r base.txt
psycopg2
gunicorn