Hi, guys, my django app is using 2 domains, but one of them needs to be for the django admin or any other urls and not the main website.
How i can solve this?, im using gunicorn and nginx.
Thank you
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
It’s hard to give you a good answer without some more details about your project. If both domains are part of the same project, you’ll probably need to use something like Django’s “sites framework" in order to direct requests correctly. Is this something you are already doing?
Using gunicorn, you’ll need to run a seperate processes for each site as each will have it’s own settings file. For instance, to run the admin portal on a separate domain you could create a
settings_admin.py
like:And an
urls_admin.py
file like:Then launch the gunicorn processes (of course you’ll want to set this up with Upstart or supervisord in production):
Then you need to configure Nginx: