views:

60

answers:

2

I have a very strange problem, and I don't know how to fix or debug it.

Short Story: I get locked out of my Django app when Debug is set to False.

Long story:

Case 1 (the first time it happened):
1. I enter my login info, but It just redirects to the login page.
2. I restart the server, try to login, and it works fine, I get in.
3. a few hours later I come back, log out, try to log back in and I can't. It just redirects to the login page.

Case 2 (I figure out how to provoke the login failure):
1. I restart the server and am able to login to the site.
2. I log in and log out several times, everything is fine.
3. I go to a non-existing page and get a server error.
4. I log out and try to log back in, and I can't, just get redirected back to the login page.

Case 3 (I can't provoke the login failure with Debug set to True):
1. I restart the server and am able to login to the site.
2. I log in and log out several times, everything is fine.
3. I go to a non-existing page and get a traceback.
4. I log out and log back in, everything works.
5. I wait and play around with it and can't get the login to fail while in Debug mode.

Please help!

A: 

Do you have a custom 500 error handler set up? Is that doing something weird with the session, perhaps?

Daniel Roseman
A: 

I would guess that this is related to errors in admin classes requiring the devserver to be restarted to continue.

As nothing is being reportedm I would try removing all of your admin.py definitions and just use the basic admin.site.register(SomeModel) for everything and seeing if it still happens, then add them back in until it re-occurs.

dysmsyd