Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6598759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:23:44+00:00 2026-05-25T18:23:44+00:00

I have multiple Django projects running on one server using gunicorn and nginx .

  • 0

I have multiple Django projects running on one server using gunicorn and nginx. Currently they are each configured to run on a unique port of the same IP address using the server directive in nginx. All this works fine.

...
server {
    listen 81;
    server_name my.ip.x.x;
    ... #static hosting and reverse proxy to site1
}
server {
    listen 84;
    server_name my.ip.x.x;
    ... #static hosting and reverse proxy to site2
}
...

I came across a problem when I had 2 different projects open in 2 tabs and I realized that I could not be logged into both sites at once (both use the built-in Django User model and auth). Upon inspecting the cookies saved in my browser, I realized that the cookie is bound to just the domain name (in my case just an ip address) and it does not include the port.

On the second site, I tried changing SESSION_COOKIE_NAME annd SESSION_COOKIE_DOMAIN, but it doesn’t seem to be working and with these current settings I can’t even log in.

SESSION_COOKIE_DOMAIN = 'my.ip.x.x:84'  #solution is to leave this as default
SESSION_COOKIE_NAME = 'site2'           #just using this works 
SESSION_COOKIE_PATH = '/'               #solution is to leave this as default

#site1 is using all default values for these

What do I need to do to get cookies for both sites working independently?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:23:45+00:00Added an answer on May 25, 2026 at 6:23 pm

    Just change the SESSION_COOKIE_NAME. The SESSION_COOKIE_DOMAIN doesn’t support port numbers afaik. So they are all the same for your apps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have multiple Django sites running from one Apache server through WSGI and
I have multiple sites for the same client, on the same server, running django,
I am running cherokee to serve a django app using uwsgi. I have been
I have a django project using multiple databases. I am using django-nose as the
I have a legacy application which is (currently) using Django to effectively display data.
Hi I am working on an application in Django. I have multiple threads running
Using the following related models (one blog entry can have multiple revisions): class BlogEntryRevision(models.Model):
I have a Django project in which multiple processes are accessing the backend mysql
Hello I need to have multiple language support of my django admin application.I can
I have a Django template that I want to extend in multiple places. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.