revert settings

This commit is contained in:
Senad Uka
2023-07-05 19:52:15 +02:00
parent 9bb8af4b9c
commit 2ba56e5852

View File

@@ -1,7 +1,7 @@
"""
Django settings for gettingstarted project.
Django settings for CTOAsYouGo project.
Generated by 'django-admin startproject' using Django 4.2.1.
Generated by 'django-admin startproject' using Django 4.2.2.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/
@@ -10,53 +10,26 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
"""
import os
import secrets
from pathlib import Path
import dj_database_url
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Before using your Heroku app in production, make sure to review Django's deployment checklist:
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# Django requires a unique secret key for each Django app, that is used by several of its
# security features. To simplify initial setup (without hardcoding the secret in the source
# code) we set this to a random value every time the app starts. However, this will mean many
# Django features break whenever an app restarts (for example, sessions will be logged out).
# In your production Heroku apps you should set the `DJANGO_SECRET_KEY` config var explicitly.
# Make sure to use a long unique value, like you would for a password. See:
# https://docs.djangoproject.com/en/4.2/ref/settings/#std-setting-SECRET_KEY
# https://devcenter.heroku.com/articles/config-vars
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get(
"DJANGO_SECRET_KEY",
default=secrets.token_urlsafe(nbytes=64),
)
# The `DYNO` env var is set on Heroku CI, but it's not a real Heroku app, so we have to
# also explicitly exclude CI:
# https://devcenter.heroku.com/articles/heroku-ci#immutable-environment-variables
IS_HEROKU_APP = "DYNO" in os.environ and not "CI" in os.environ
ISDEBUG = "DEBUG" in os.environ and not "CI" in os.environ
SECRET_KEY = 'django-insecure-d8gmbk-g2&ue)k_74169!l@oiue8ra%@d4qm@jc=3&%&*%(oah'
# SECURITY WARNING: don't run with debug turned on in production!
if ISDEBUG:
DEBUG = True
else:
DEBUG = False
DEBUG = True
# On Heroku, it's safe to use a wildcard for `ALLOWED_HOSTS``, since the Heroku router performs
# validation of the Host header in the incoming HTTP request. On other platforms you may need
# to list the expected hostnames explicitly to prevent HTTP Host header attacks. See:
# https://docs.djangoproject.com/en/4.2/ref/settings/#std-setting-ALLOWED_HOSTS
if IS_HEROKU_APP:
ALLOWED_HOSTS = ["*"]
else:
ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'ctoasyougo.com', 'www.ctoasyougo.com','ctoasyougo-3015a1b209e7.herokuapp.com']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
@@ -70,97 +43,6 @@ INSTALLED_APPS = [
'widget_tweaks',
]
WSGI_APPLICATION = 'CTOAsYouGo.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
if IS_HEROKU_APP:
# In production on Heroku the database configuration is derived from the `DATABASE_URL`
# environment variable by the dj-database-url package. `DATABASE_URL` will be set
# automatically by Heroku when a database addon is attached to your Heroku app. See:
# https://devcenter.heroku.com/articles/provisioning-heroku-postgres
# https://github.com/jazzband/dj-database-url
DATABASES = {
"default": dj_database_url.config(
conn_max_age=600,
conn_health_checks=True,
ssl_require=True,
),
}
else:
# When running locally in development or in CI, a sqlite database file will be used instead
# to simplify initial setup. Longer term it's recommended to use Postgres locally too.
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": BASE_DIR / "db.sqlite3",
}
}
# 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-us"
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 files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_ROOT = BASE_DIR / 'static'
STATIC_URL = '/static/'
STORAGES = {
# Enable WhiteNoise's GZip and Brotli compression of static assets:
# https://whitenoise.readthedocs.io/en/latest/django.html#add-compression-and-caching-support
"staticfiles": {
"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
},
}
# Don't store the original (un-hashed filename) version of static files, to reduce slug size:
# https://whitenoise.readthedocs.io/en/latest/django.html#WHITENOISE_KEEP_ONLY_HASHED_FILES
WHITENOISE_KEEP_ONLY_HASHED_FILES = True
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
# Application definition
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
@@ -235,6 +117,11 @@ USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_ROOT = BASE_DIR / 'static'
STATIC_URL = '/static/'
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field