Your browser does not seem to accept the session cookies that Django sends.
Your browser should be able to tell you which cookies are set to respond to the page from your application. Make sure that the "sessionid" cookie is indeed sent and that the domain and path are correct.
If you have SESSION_COOKIE_DOMAIN or SESSION_COOKIE_PATH settings.py file is set incorrectly, they can cause Django to set cookies in the browser that do not return to the server.
If you want to check your entire setup, start by reading: http://docs.djangoproject.com/en/1.2/topics/http/sessions/
In a nutshell you need:
- there is
'django.contrib.sessions' in INSTALLED_APPS ; - have
'django.contrib.sessions.middleware.SessionMiddleware' in MIDDLEWARE_CLASSES ; and - on a production server, you may need to set
SESSION_COOKIE_DOMAIN and SESSION_COOKIE_PATH in order to interact well with other web applications in the same domain or related domains.
Edit:
Having looked at your inserted settings, I see that two different things are happening, each of which is enough to stop the session cookie.
SESSION_COOKIE_DOMAIN set to "mydomain.com"
A cookie for a common TLD requires that part of the "domain" contain at least two period separators (".") In it. This prevents people from setting cookies for domains such as ".com". (It is assumed that cookies for domains under jurisdiction at the country level require three periods.)
Change this to ".mydomain.com" and it should be returned by the browser.
In development (on your local computer, 127.0.0.1) leave this parameter blank or your browser will not accept cookies at all.
SESSION_COOKIE_PATH set to "/ tmp"
It looks like an error if your web application is hosted at " http://mydomain.com/tmp/ "
SESSION_COOKIE_PATH used to indicate the component of the "path" of the cookie, that is, the URL prefix in which the cookie will be returned to the server. This allows you to place one application in "mydomain.com/firstapp/" and another in "mydomain.com/secondapp/", and you can be sure that the cookie "sessionid" will not be confused between them.
If you have only one application hosted under this domain name, leave it blank and the default will be "/" (entire domain)
To control where Django stores session data on your file system (which is similar to what you are trying to do), you can use the SESSION_FILE_PATH parameter. By default, it is "/ tmp /", so you do not need to install it at all.
source share