Running multiple Django Projects on a same machine

You only need to do 2 things:

1. Run those Django projects on different ports

2. Set different session cookie names for them. Example:

- Project1: settings.py:
SESSION_COOKIE_NAME = 'project1'

- Project2: settings.py:
SESSION_COOKIE_NAME = 'project2'


In addition, if your Django servers are under a nginx reverse proxy:


Notes:

According to Django security notes (https://www.djangoproject.com/weblog/2012/dec/10/security/), Hostnames must consist of characters [A-Za-z0-9] plus hyphen ('-') or dot ('.'), we have to use '-' (hyphen) instead of '_' (underscore) when naming the upstream server: 'my-first-project', 'my-second-project'

Comments