Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't sign in to Django admin

I can't sign in to Django admin with any of the superusers I've created. Tried creating new superusers, changing passwords, etc. - no error messages for any of these processes, but still can't sign in.

I'm not sure if it's related, but I also can't run django-admin.py commands. Here is what I've done so far:

$ django-admin.py validate  
Error: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.  
$ export DJANGO_SETTINGS_MODULE=mysite.settings  
$ django-admin.py validate  
Error: Could not import settings 'mysite.settings' (Is it on sys.path? Does it have syntax errors?): No module named mysite.settings

sys.path shows ['/Users/joerobinson/Sites/django/mysite' ... (other stuff on path)]

Is there something else I need to do to register the mysite module?

python manage.py runserver works fine.

Conclusion
For the question about logging in to django admin, I did not have django.contrib.auth.backends.ModelBackend included in my AUTHENTICATION_BACKENDS - adding this allowed me to sign in to admin.

I'm still working on the django-admin.py configuration question (which appears to not be related), and will reopen it in a separate question.

like image 770
Joe Avatar asked Jan 26 '11 18:01

Joe


1 Answers

In my case, I had "SESSION_COOKIE_SECURE = True" because I was trying SSL configurations. Just commenting this line worked.

like image 82
daigorocub Avatar answered Sep 22 '22 06:09

daigorocub