Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Django settings for davixxa_website project.
- Generated by 'django-admin startproject' using Django 1.9.
- For more information on this file, see
- https://docs.djangoproject.com/en/1.9/topics/settings/
- For the full list of settings and their values, see
- https://docs.djangoproject.com/en/1.9/ref/settings/
- """
- import os
- from django.conf.locale.en import formats as en_formats
- en_formats.DATETIME_FORMAT = "F jS, Y H:i"
- # 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/1.9/howto/deployment/checklist/
- # SECURITY WARNING: don't run with debug turned on in production!
- DEBUG = False
- DOCKER = False
- # SECURITY WARNING: keep the secret key used in production secret!
- if DEBUG:
- SECRET_KEY = '@snpcev(q2)bjlbq*yw52%xsa#s1lx7t=21shxz!r&9+9$g2^z'
- else:
- SECRET_KEY = os.environ["DAVIXXA_SECRET_KEY"]
- #ALLOWED_HOSTS = ["davixxa.net", "www.davixxa.net", "www.davixxa.ml", "davixxa.ml"]
- ALLOWED_HOSTS = [".davixxa.net", ".davixxa.ml"]
- SECURE_SSL_REDIRECT = False
- # Site definition
- SITE = {
- "url": "https://davixxa.net",
- "logo_url": "https://pbs.twimg.com/profile_images/685958901431287808/g_DfNBbP_400x400.png",
- "title": "Davixxa",
- "description": "RAMBLINGS OF A LAZY WEEB TECH ENTHUSIAST."
- }
- # Application definition
- INSTALLED_APPS = [
- 'posts',
- 'projs', # 'projects' collides with the django internal 'projects' namespace
- 'static_pages',
- 'gitlab_watcher',
- 'markdownx',
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- ]
- 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 = 'davixxa_website.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 = 'davixxa_website.wsgi.application'
- # Database
- # https://docs.djangoproject.com/en/1.9/ref/settings/#databases
- if DEBUG:
- if DOCKER:
- """If Docker is set, use docker, if not, use a sqlite3 backend."""
- DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.mysql',
- 'NAME': "davixxa",
- 'USER': "root",
- 'PASSWORD': "redacted",
- 'HOST': "db",
- 'PORT': "3306",
- }
- }
- else:
- DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
- }
- }
- else:
- """Use mysql in production
- This has been confirmed to be possible, however, the host domain
- has to be known beforehand such that it can be set to trusted in the DB
- please contact @kasperfred <kasper@kasperfred.com> for more details
- """
- DATABASES = {
- 'default': {
- #'ENGINE': 'django.db.backends.mysql',
- 'ENGINE': 'mysql.connector.django',
- 'NAME': os.environ['DAVIXXA_DATABASE_NAME'],
- 'USER': os.environ['DAVIXXA_DATABASE_USER'],
- 'PASSWORD': os.environ['DAVIXXA_DATABASE_PASSWORD'],
- 'HOST': os.environ['DAVIXXA_DATABASE_HOST'],
- 'PORT': os.environ['DAVIXXA_DATABASE_PORT'],
- }
- }
- # HTTPS
- if DEBUG:
- SECURE_SSL_REDIRECT = False
- SESSION_COOKIE_SECURE = False
- CSRF_COOKIE_SECURE = False
- else:
- SECURE_SSL_REDIRECT = True
- SESSION_COOKIE_SECURE = True
- CSRF_COOKIE_SECURE = True
- # Password validation
- # https://docs.djangoproject.com/en/1.9/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/1.9/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/1.9/howto/static-files/
- STATIC_URL = '/static/'
- STATIC_ROOT = BASE_DIR + "/public/static"
- STATICFILES_DIRS = [
- os.path.join(BASE_DIR, "static"),
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement