diff --git a/network_inventory/network_inventory/settings/production.py b/network_inventory/network_inventory/settings/production.py index 7c151b9..6256544 100644 --- a/network_inventory/network_inventory/settings/production.py +++ b/network_inventory/network_inventory/settings/production.py @@ -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 diff --git a/production.sh b/production.sh new file mode 100755 index 0000000..dc69739 --- /dev/null +++ b/production.sh @@ -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 diff --git a/requirements/docker.txt b/requirements/docker.txt index dc2f8bb..017a90e 100644 --- a/requirements/docker.txt +++ b/requirements/docker.txt @@ -1,3 +1,4 @@ -r base.txt psycopg2 +gunicorn