I have error in Django project when I deploy to elastic beanstalk everything is ok but when I go to my server it gives me internal server error

I need help with my Django project when I deploy to elastic beanstalk everything is ok but when I go to my server it gives me an internal server error I do not know where the error is because everything looks fine here is my server and my code

settings.py

import os
from json.tool import main
from pathlib import Path
# from datetime import timedelta

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
from datetime import timedelta


# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-jkkab)y!n*=e1w9w%1939+cqkj0-_cm(evbc65&-s%qede_9z&'

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

ALLOWED_HOSTS = ['roshbaw-env.eba-f9y6i6ns.us-west-2.elasticbeanstalk.com']

# Application definition

INSTALLED_APPS = [
   'main',
   'corsheaders',
   'rest_framework',
   'rest_framework.authtoken',
   'django.contrib.admin',
   'django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.sessions',
   'django.contrib.messages',
   'django.contrib.staticfiles',
   # 'rest_framework_simplejwt.token_blacklist'
   # 'storages',
]



MIDDLEWARE = [
   'corsheaders.middleware.CorsMiddleware',
   '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 = 'new_lms.urls'

TEMPLATES = [
    {
       'BACKEND': 'django.template.backends.django.DjangoTemplates',
       'DIRS': [],
       '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 = 'new_lms.wsgi.application'




DATABASES = {
    'default': {
         'ENGINE': 'django.db.backends.mysql',
         'NAME': 'RBCLASSDBEB',
         'USER': 'admin',
         'PASSWORD':'12341234',
         'HOST':'mydb.caw7sl9jtojs.us-west-2.rds.amazonaws.com',
         'PORT':'3306',
     }
 }


 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/4.0/topics/i18n/

LANGUAGE_CODE = 'en-us'
# LANGUAGE_CODE = 'kur'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True

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

# STATIC_ROOT=os.path.join(BASE_DIR,'staticfiless')

STATIC_URL = 'static/'
STATIC_ROOT = 'static'
# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# CORS_ORIGIN_ALLOW_ALL = True
# CORS_ALLOW_CREDENTIALS = True

MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'mediafiles'

AUTH_USER_MODEL = 'main.User'
# ACCOUNT_UNIQUE_EMAIL=True

and here is my django.config

option_settings:
aws:elasticbeanstalk:application:environment:
DJANGO_SETTINGS_MODULE: "new_lms.settings"
PYTHONPATH: "/var/app/current:$PYTHONPATH"
aws:elasticbeanstalk:container:python:
WSGIPath: "new_lms.wsgi:application"
aws:elasticbeanstalk:environment:proxy:staticfiles:
static:static

here is my 01_packages.config

packages: 
 yum:
  python3-devel: []
  mariadb-devel: []

and here is my requirements.txt

asgiref==3.5.2
Django==4.1.3
django-cors-headers==3.13.0
djangorestframework==3.14.0
gunicorn==20.1.0
mysqlclient==2.1.1
pytz==2022.6
sqlparse==0.4.3
tk-tools==0.16.0
tzdata==2022.6

here is my log in elastic beanstalkenter image description here

enter image description here enter image description here

Back to Top