How do I use multiple settings file in Django with multiple sites on one server?

Posted by William Bing Hua on Stack Overflow See other posts from Stack Overflow or by William Bing Hua
Published on 2014-06-08T02:49:25Z Indexed on 2014/06/08 3:25 UTC
Read the original article Hit count: 183

Filed under:
|
|
|
|

I have an ec2 instance running Ubuntu 14.04 and I want to host two sites from it. On my first site I have two settings file, production_settings.py and settings.py (for local development). I import the local settings into the production settings and override any settings with the production settings file.

Since my production settings file is not the default settings.py name, I have to create an environment variable

DJANGO_SETTINGS_MODULE='site1.production_settings'

However because of this whenever I try to start my second site it says

No module named site1.production_settings

I am assuming that this is due to me setting the environment variable. Another problem is that I won't be able to use different settings file for different sites.

How do I start use two different settings file for two different websites?

© Stack Overflow or respective owner

Related posts about python

Related posts about django