I'm working on a Django app hosted on Heroku. I'm able to login to the admin with my username, password. But on every single click (or on each click after a few seconds) it redirects me to the login page again with the ?next=/admin/model
added to the url. Infact sometimes it asks for login multiple times before it lets me view the admin console. This behaviour is not reflected in local deployment. Admin works just fine locally.
I tried the suggestion mentioned here:https://docs.djangoproject.com/en/1.8/faq/admin/#i-can-t-log-in-when-i-enter-a-valid-username-and-password-it-just-brings-up-the-login-page-again-with-no-error-messages. But that does not help.
Any clue what I could be doing wrong?
Here is my settings.py:
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/# SECURITY WARNING: keep the secret key used in production secret!# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = TrueTEMPLATE_DEBUG = TrueALLOWED_HOSTS = []# Application definitionINSTALLED_APPS = ('django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles','haystack','hash','smuggler',)MIDDLEWARE_CLASSES = ('django.contrib.sessions.middleware.SessionMiddleware','django.middleware.common.CommonMiddleware','django.contrib.auth.middleware.AuthenticationMiddleware','django.contrib.messages.middleware.MessageMiddleware','django.middleware.clickjacking.XFrameOptionsMiddleware','django.middleware.csrf.CsrfViewMiddleware',
)ROOT_URLCONF = 'ssite.urls'WSGI_APPLICATION = 'ssite.wsgi.application'SESSION_ENGINE = "django.contrib.sessions.backends.cache" TEMPLATE_CONTEXT_PROCESSORS = ('django.contrib.auth.context_processors.auth','django.core.context_processors.debug','django.core.context_processors.i18n','django.core.context_processors.media','django.core.context_processors.static','django.core.context_processors.tz','django.contrib.messages.context_processors.messages','django.contrib.auth.context_processors.auth',AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',)DATABASES = {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2','NAME': 'hash','USER': 'dc','PASSWORD': 'dc','HOST': '127.0.0.1','PORT': '5432',}
}LANGUAGE_CODE = 'en-us'TIME_ZONE = 'Asia/Kolkata'USE_I18N = TrueUSE_L10N = TrueUSE_TZ = TrueSESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_SAVE_EVERY_REQUEST = True
SESSION_COOKIE_AGE = 86400 # sec
SESSION_COOKIE_DOMAIN = None
SESSION_COOKIE_NAME = 'DSESSIONID'
SESSION_COOKIE_SECURE = FalseBASE_DIR = os.path.dirname(os.path.abspath(__file__))MEDIA_ROOT = os.path.join(BASE_DIR, 'media')MEDIA_URL = '/media/'HAYSTACK_CONNECTIONS = {'default': {'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine','URL': 'http://127.0.0.1:9200/','INDEX_NAME': 'haystack',},
}# Parse database configuration from $DATABASE_URL
import dj_database_url
DATABASES['default'] = dj_database_url.config()# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')# Allow all host headers
ALLOWED_HOSTS = ['*']# Static asset configuration
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'static'
STATIC_URL = '/static/'
#STATIC_ROOT = os.path.join(BASE_DIR, 'static')STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),
)
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'FIXTURE_DIRS = (os.path.join(BASE_DIR, 'fixtures'),
)from urlparse import urlparsees = urlparse(os.environ.get('SEARCHBOX_URL') or 'http://127.0.0.1:9200/')port = es.port or 80HAYSTACK_CONNECTIONS = {'default': {'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine','URL': es.scheme + '://' + es.hostname + ':' + str(port),'INDEX_NAME': 'documents',},
}if es.username:HAYSTACK_CONNECTIONS['default']['KWARGS'] = {"http_auth": es.username + ':' + es.password}try:from local_settings import *
except ImportError as e:pass