apache - Django Login/Session Not Sticking Over HTTPS -


i'm working on django site hosted on apache server mod_wsgi. site on https have apache redirect http requests https.

the project i'm working on called skittle. have custom user model called skittleuser inherits abstractbaseuser , set auth_user_model in our settings.py file.

os.environ['https'] = "on" set in wsgi.py file.

session_cookie_secure = true , csrf_cookie_secure = true both set in settings.py

the issue having right logging in user unreliable. when go login page, times works while other times doesn't. while browsing site, lose session , kicked down anonymous user.

we running our test site here if wants take look: https://skittle.newlinetechnicalinnovations.com/discover/
our production site @ www.dnaskittle.com not yet incorporate user logins feature doesn't work.

a test user: email: test@dnaskittle.com password: asdf

if login not work, see in top right "welcome, login" in case, try clicking on login again , use same credentials. may take 5-6 times of doing process before logged in.

you know works when see "welcome tester, logout, genomes"

after logged in, may stick while, browsing around other pages kick off. there no consistent amount of pages can go through before happens, , doesn't happen on specific page.

any insights on appreciated.

also of note, going django admin page (which not our code, base django code) has same issue.

i've gotten issue sorted out now. users can not login while on https using while using listed setup.

what did:

in settings.py add:

session_save_every_request = true session_cookie_name = 'dnaskittle' 

i wiped current django_sessions database in case causing issues old lingering data.

i did not setup middleware or sslredirect, , working ship shape.


Comments