Reputation: 843
I've deployed my Django project using this tutorial and it works fine.
Now I want to split the settings file and have multiple settings in development and production environments. I created a settings
directory and added these files into the directory:
my_project/
manage.py
my_project/
__init__.py
urls.py
wsgi.py
settings/
__init__.py
base.py
dev.py
prod.py
The base.py
is same as former settings.py
(that was working fine). I imported base.py
and added DEBAG=False
and ALLOWED_HOSTS
to prod.py
.
How can I tell the gunicorn to run my application with prod
settings?
The gunicorn.service
file, based on the tutorial is like this:
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=sammy
Group=www-data
WorkingDirectory=/home/sammy/myproject
ExecStart=/home/sammy/myproject/myprojectenv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/sammy/myproject/myproject.sock myproject.wsgi:application
[Install]
WantedBy=multi-user.target
Upvotes: 0
Views: 2313
Reputation: 843
The problem was the settings.pyc
file in the project directory. Removing that file, fixed the problem.
Upvotes: 0