SHARE
TWEET

django setting

a guest Oct 21st, 2019 105 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. """
  2. Django settings for composeexample project.
  3.  
  4. Generated by 'django-admin startproject' using Django 1.11.5.
  5.  
  6. For more information on this file, see
  7. https://docs.djangoproject.com/en/1.11/topics/settings/
  8.  
  9. For the full list of settings and their values, see
  10. https://docs.djangoproject.com/en/1.11/ref/settings/
  11. """
  12.  
  13. import os
  14. import environ
  15.  
  16. env = environ.Env(
  17.     # set casting, default value
  18.     DEBUG=(bool, False)
  19. )
  20. # reading .env file
  21. environ.Env.read_env()
  22.  
  23. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  24. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  25.  
  26.  
  27. # Quick-start development settings - unsuitable for production
  28. # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
  29.  
  30. # SECURITY WARNING: keep the secret key used in production secret!
  31. # Raises django's ImproperlyConfigured exception if SECRET_KEY not in os.environ
  32. SECRET_KEY = env('SECRET_KEY')
  33.  
  34.  
  35. # SECURITY WARNING: don't run with debug turned on in production!
  36. DEBUG = env('DEBUG')
  37.  
  38. ALLOWED_HOSTS = ['localhost']
  39.  
  40. # Application definition
  41.  
  42. INSTALLED_APPS = [
  43.     'app',
  44.     'django.contrib.admin',
  45.     'django.contrib.auth',
  46.     'django.contrib.contenttypes',
  47.     'django.contrib.sessions',
  48.     'django.contrib.messages',
  49.     'django.contrib.staticfiles',
  50. ]
  51.  
  52. MIDDLEWARE = [
  53.     'django.middleware.security.SecurityMiddleware',
  54.     'django.contrib.sessions.middleware.SessionMiddleware',
  55.     'django.middleware.common.CommonMiddleware',
  56.     'django.middleware.csrf.CsrfViewMiddleware',
  57.     'django.contrib.auth.middleware.AuthenticationMiddleware',
  58.     'django.contrib.messages.middleware.MessageMiddleware',
  59.     'django.middleware.clickjacking.XFrameOptionsMiddleware',
  60. ]
  61.  
  62.  
  63. ROOT_URLCONF = 'composeexample.urls'
  64.  
  65. TEMPLATES = [
  66.     {
  67.         'BACKEND': 'django.template.backends.django.DjangoTemplates',
  68.         'DIRS': [],
  69.         'APP_DIRS': True,
  70.         'OPTIONS': {
  71.             'context_processors': [
  72.                 'django.template.context_processors.debug',
  73.                 'django.template.context_processors.request',
  74.                 'django.contrib.auth.context_processors.auth',
  75.                 'django.contrib.messages.context_processors.messages',
  76.             ],
  77.         },
  78.     },
  79. ]
  80.  
  81. WSGI_APPLICATION = 'composeexample.wsgi.application'
  82.  
  83.  
  84. # Database
  85. # https://docs.djangoproject.com/en/1.11/ref/settings/#databases
  86.  
  87. # Parse database connection url strings like psql://user:pass@127.0.0.1:8458/db
  88. DATABASES = {
  89.     # read os.environ['DATABASE_URL'] and raises ImproperlyConfigured exception if not found
  90.     'default': env.db(),
  91. }
  92.  
  93. # Password validation
  94. # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
  95.  
  96. AUTH_PASSWORD_VALIDATORS = [
  97.     {
  98.         'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  99.     },
  100.     {
  101.         'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  102.         'OPTIONS': {
  103.             'min_length': 9,
  104.         }
  105.     },
  106.     {
  107.         'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  108.     },
  109.     {
  110.         'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  111.     },
  112. ]
  113.  
  114.  
  115. # Internationalization
  116. # https://docs.djangoproject.com/en/1.11/topics/i18n/
  117.  
  118. LANGUAGE_CODE = 'en-us'
  119.  
  120. TIME_ZONE = 'UTC'
  121.  
  122. USE_I18N = True
  123.  
  124. USE_L10N = True
  125.  
  126. USE_TZ = True
  127.  
  128.  
  129. # Static files (CSS, JavaScript, Images)
  130. # https://docs.djangoproject.com/en/1.11/howto/static-files/
  131.  
  132. STATIC_URL = '/static/'
  133.  
  134. STATICFILES_DIRS = [
  135.     os.path.join(BASE_DIR, "static"),
  136.     '/var/www/static/',
  137. ]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top