0

this is the my settings.py file

import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 't8%5^$plkjtbt6bm3zngoh*5-8(e#xb_sw)9kd&!_=67)#49mk'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

ALLOWED_HOSTS = ['*']


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'app1.apps.App1Config',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'main_jntu.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 = 'main_jntu.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.sqlite3',
    'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
    'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
    'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
    'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
    'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]

# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')

this is my gunicorn.conf

2020-02-12 16:59:53 +0000] [11377] [INFO] Starting gunicorn 20.0.4
[2020-02-12 16:59:53 +0000] [11377] [INFO] Listening at: unix:/home/ubuntu/js/app.sock 
(11377)
[2020-02-12 16:59:53 +0000] [11377] [INFO] Using worker: sync
[2020-02-12 16:59:53 +0000] [11381] [INFO] Booting worker with pid: 11381
[2020-02-12 16:59:53 +0000] [11383] [INFO] Booting worker with pid: 11383
[2020-02-12 16:59:53 +0000] [11384] [INFO] Booting worker with pid: 11384

this is my ngix django.conf

server {
listen 80;
server_name 13.233.92.134;

location / {
    include proxy_params;
    proxy_pass http://unix:/home/ubuntu/js/app.sock;
}

}

i have the same servererror before when iam trying to bind with gunicorn --bind also i have got same error that server error (500). before but at that time i didnot resolved i continued for the further steps but this time its needed to solve

gunicorn --bind 0.0.0.0:8000 main_jntu.wsgi:application
(main_jntu) is my project name

at that also i have got server error (500)

please help me this out. and thanks

  • Looks like something else is already using port 80. On a linux box, it's typically either nginx or apache. You should turn off that web server first before starting a new one. – Håken Lid Feb 12 '20 at 19:01
  • Does this answer your question? [Nginx will not start (Address already in use)](https://stackoverflow.com/questions/42303401/nginx-will-not-start-address-already-in-use) – Håken Lid Feb 12 '20 at 19:02
  • @HåkenLid the error which i have before also when iam not using nginx and iam just using. gunicorn --bind 0.0.0.0:8000 main_jntu.wsgi:application at that time also i have got the server error – Rajashekhar Reddy Feb 12 '20 at 19:05
  • 1
    I'm confused. You have gunicorn opening port 8000 but then the nginx config seems to be pointing to a unix socket. – Tim Tisdall Feb 12 '20 at 19:58

1 Answers1

0

i have resolved the issue is my django project is on 2.2.7 and while iam deploying on aws i used latest version so i got the server error

note:use only the version of django you used while developing project and use same version while deploying the project