Reputation: 13
Server Error (500) I only encounter this error when trying to access this page: https://e-courses.onrender.com/course/1/ after uploading it to render.
Here is the website link and the repository link on GitHub: website on render: https://e-courses.onrender.com/ repo: https://github.com/HamzaWaleedDV/e_academy
settings.py:
"""
Django settings for academy project.
Generated by 'django-admin startproject' using Django 4.2.5.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
"""
import os
from pathlib import Path
import dj_database_url
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-)b!9$0$t-985es5kf$xsiw5bek^+wl^5w(&%(ft5f6w6e_xg@w'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['e-courses.onrender.com']
# Application definition
INSTALLED_APPS = [
'accounts',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'academy_courses',
'academy_blog',
'tinymce',
'django_cleanup.apps.CleanupConfig',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'academy.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',
'academy_courses.custom_context_proccessor.slider_footer',
'academy_courses.custom_context_proccessor.category',
'academy_courses.custom_context_proccessor.slider_image',
],
},
},
]
WSGI_APPLICATION = 'academy.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'e_courses',
'USER': 'hamzawaleed',
'PASSWORD': 'xI1W8KZKxTqMgv2FHzBY3fB9ghjZ96Ps',
'HOST': 'dpg-ck9bsmegtj9c73brojh0-a',
'PORT': '5432',
}
}
database_url = os.environ.get('DATABASE_URL')
DATABASES['default'] = dj_database_url.parse(database_url)
# Password validation
# https://docs.djangoproject.com/en/4.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/4.2/topics/i18n/
LANGUAGE_CODE = 'en'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
MEDIA_URL = '/static/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'staticfiles/media')
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
LOGIN_REDIRECT_URL = '/accounts/profile/'
LOGOUT_REDIRECT_URL = '/accounts/login/'
# TINYMCE_JS_URL = 'https://cdn.tiny.cloud/1/3u0j2svll0bmrfef0ytdyyjz9u1drkii7i1xaqzl2dldjcs3/tinymce/6/tinymce.min.js'
TINYMCE_JS_URL = os.path.join(MEDIA_URL, "tinymce/js/tinymce/tinymce.min.js")
TINYMCE_COMPRESSOR = False
TINYMCE_DEFAULT_CONFIG = {
'plugins': 'anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount checklist mediaembed casechange export formatpainter pageembed linkchecker a11ychecker tinymcespellchecker permanentpen powerpaste advtable advcode editimage tinycomments tableofcontents footnotes mergetags autocorrect typography inlinecss',
'toolbar': 'undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | link image media table mergetags | addcomment showcomments | spellcheckdialog a11ycheck typography | align lineheight | checklist numlist bullist indent outdent | emoticons charmap | removeformat',
}
CURRENCY = 'USD'
STRIPE_PUBLISHABLE_KEY = 'pk_test_51NtWdsDLahRA4l85w357JYbfxsELq7Ry2X9f9TaJM51ce93wipRu2ypGL8hE8eNyjVljxE7VXHKbvjkxR6HlsgNc00FdWGyb9L'
STRIPE_ENDPOINT_SECRET = 'whsec_75bb5687a7bb6245a295da45ef55b4ca40eee937254c66391d23118db90edc15'
STRIPE_SECRET_KEY = 'sk_test_51NtWdsDLahRA4l85l7VsRrz2iyPV6e20C560o44Wm8uv4VUsGB3hzgssV1Fq9DxkUWeXqQUodgLuGgGWcMzAY55Z00L97dN9kR'
LANGUAGE_COOKIE_NAME = "lang"
Upvotes: 0
Views: 116