I'm using django 1.9,gunicorn,nginx and postgres as database for my website. My site is up and running but when i try to login as admin or user i get server error 500 on webpage and on terminal i get "is the server running on host 139.59.45.246 and accepting tcp/ip connections on port 5432".
I thought there might be a problem in postgres.conf and pg_hba.conf. But there are 2 host all all....one for IPv4 and one for IPv6 in pg_hba.conf.
I can't figure out how to edit pg_hba.conf. Please use above's IP to explain.
One more thing will it solve the problem or i might need to do something else?
Here my settings.py-
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '^4z+c_2^di81mt7sj@e8c&_b%###############'
DEBUG = False
ALLOWED_HOSTS = ['irenovate.in', '139.59.45.246']
INSTALLED_APPS = [
# django apps
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# my apps
'website',
'accounts',
# third party apps
'crispy_forms',
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'irenovate.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, "templates")],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'irenovate.wsgi.application'
# Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '########',
'USER': '########',
'PASSWORD': '........',
'HOST': '139.59.45.246',
'PORT': '',
}
}
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_in_env", "static")
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static_in_project", "our_static"),
)
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_in_env", "media_root")
CRISPY_TEMPLATE_PACK = 'bootstrap3'