Django admin login does not redirect

I can view the admin login page of django admin, but after entering the correct login information, it will remain on the same login page with empty text fields. It will show messages if the login details are incorrect. I have the following: what methods can be fixed since the log says nothing.

What are some ways to test shell login?

Use manage.py createuperuser to create superuser by default skipping during syncdb startup

Cleared cookies and retries are retried.

Fix SITE_ID in settings.py

settings.py import logging import pwd import os DEBUG = True TEMPLATE_DEBUG = DEBUG DEBUG_TOOLBAR = False PROFILER_ON = False INTERNAL_IPS = ( '127.0.0.1' ) ADMINS = ( ('Admin', ' test@domain.com '), ) SEND_BROKEN_LINK_EMAILS = False MANAGERS = ADMINS DEFAULT_FROM_EMAIL = ' test@domain ' SERVER_EMAIL = DEFAULT_FROM_EMAIL EMAIL_HOST = 'test' UPLOAD_ROOT = '/domain/uploads' PUBLIC_UPLOAD_ROOT = '/domain/htdocs/public_uploads' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'table_name', 'USER': 'username', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': '', # use this to create InnoDB tables 'OPTIONS': { 'init_command': 'SET storage_engine=InnoDB', 'charset': 'utf8', } } } #SESSION_COOKIE_SECURE = True # Setup logging LOGGING = { 'version': 1, 'disable_existing_loggers': True, } TIME_ZONE = 'America/Chicago' LANGUAGE_CODE = 'en-us' LANGUAGES = ( ('en-us', _('English(US)')), ) SITE_ID = 1 SITE_NAME = 'my site' USE_I18N = True MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'media') MEDIA_URL = '/media/' PUBLIC_UPLOAD_URL = '/public_uploads/' UPLOAD_URL = '/uploads/' UPLOAD_IMAGES_DIR = 'images/' ADMIN_MEDIA_PREFIX = '/djangomedia/' SECRET_KEY = 'test' #SESSION_COOKIE_HTTPONLY = True #SESSION_COOKIE_DOMAIN = 'domain' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.transaction.TransactionMiddleware', 'django.middleware.doc.XViewMiddleware', 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', ) LOGIN_URL = '/login/' LOGIN_REDIRECT_URL = '/users/main/' # The URL where requests are redirected for logout. LOGOUT_URL = '/logout/' TEMPLATE_CONTEXT_PROCESSORS = ( 'django.contrib.auth.context_processors.auth', 'django.core.context_processors.i18n', 'django.core.context_processors.request', 'django.contrib.messages.context_processors.messages', ) AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', ) ROOT_URLCONF = 'myapp.urls' TEMPLATE_DIRS = ( os.path.join(os.path.dirname(__file__), 'templates'), ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.flatpages', ) urls.py url(r'^admin/', include(admin.site.urls)), 
+7
source share
1 answer

Actually, this happened because of SESSION_COOKIE_SECURE = True in my settings.py, I accidentally defined it in 2 places, one commented another one without comment, causing this, since the site is not yet working under https. It was a stupid mistake - user1076881 Apr 5 at 7:27 am

+3
source

All Articles