Advertisement
Guest User

base.py

a guest
Jul 2nd, 2018
476
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.99 KB | None | 0 0
  1. """
  2. Project main settings file. These settings are common to the project
  3. if you need to override something do it in local.pt
  4. """
  5.  
  6. from sys import path
  7.  
  8. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  9. import os
  10.  
  11. # PATHS
  12. # Path containing the django project
  13. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  14. path.append(BASE_DIR)
  15.  
  16. # Path of the top level directory.
  17. # This directory contains the django project, apps, libs, etc...
  18. PROJECT_ROOT = os.path.dirname(BASE_DIR)
  19.  
  20. # Add apps and libs to the PROJECT_ROOT
  21. path.append(os.path.join(PROJECT_ROOT, "apps"))
  22. path.append(os.path.join(PROJECT_ROOT, "libs"))
  23.  
  24.  
  25. # SITE SETTINGS
  26. # https://docs.djangoproject.com/en/2.0/ref/settings/#site-id
  27. SITE_ID = 1
  28.  
  29.  
  30. # https://docs.djangoproject.com/en/2.0/ref/settings/#allowed-hosts
  31. ALLOWED_HOSTS = ['localhost', '127.0.0.1', '[::1]']
  32.  
  33. # https://docs.djangoproject.com/en/2.0/ref/settings/#installed-apps
  34. INSTALLED_APPS = [
  35.     # Django apps
  36.     'django.contrib.admin',
  37.     'django.contrib.admindocs',
  38.     'django.contrib.auth',
  39.     'django.contrib.contenttypes',
  40.     'django.contrib.sessions',
  41.     'django.contrib.sites',
  42.     'django.contrib.messages',
  43.     'django.contrib.humanize',
  44.     'django.contrib.sitemaps',
  45.     'django.contrib.syndication',
  46.     'django.contrib.staticfiles',
  47.  
  48.     # Third party apps
  49.     'compressor',
  50.  
  51.     # Local apps
  52.     'base',
  53. ]
  54.  
  55. # https://docs.djangoproject.com/en/2.0/topics/auth/passwords/#using-argon2-with-django
  56. PASSWORD_HASHERS = [
  57.     'django.contrib.auth.hashers.Argon2PasswordHasher',
  58.     'django.contrib.auth.hashers.PBKDF2PasswordHasher',
  59.     'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
  60.     'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
  61.     'django.contrib.auth.hashers.BCryptPasswordHasher',
  62. ]
  63.  
  64. # DEBUG SETTINGS
  65. # https://docs.djangoproject.com/en/2.0/ref/settings/#debug
  66. DEBUG = False
  67.  
  68. # https://docs.djangoproject.com/en/2.0/ref/settings/#internal-ips
  69. INTERNAL_IPS = ('127.0.0.1')
  70.  
  71. # LOCALE SETTINGS
  72. # Local time zone for this installation.
  73. # https://docs.djangoproject.com/en/2.0/ref/settings/#time-zone
  74. TIME_ZONE = 'UTC'
  75.  
  76. # https://docs.djangoproject.com/en/2.0/ref/settings/#language-code
  77. LANGUAGE_CODE = 'en-us'
  78.  
  79. # https://docs.djangoproject.com/en/2.0/ref/settings/#use-i18n
  80. USE_I18N = True
  81.  
  82. # https://docs.djangoproject.com/en/2.0/ref/settings/#use-l10n
  83. USE_L10N = False
  84.  
  85. # https://docs.djangoproject.com/en/2.0/ref/settings/#use-tz
  86. USE_TZ = False
  87.  
  88.  
  89. # MEDIA AND STATIC SETTINGS
  90. # Absolute filesystem path to the directory that will hold user-uploaded files.
  91. # https://docs.djangoproject.com/en/2.0/ref/settings/#media-root
  92. MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'public/media')
  93.  
  94. # URL that handles the media served from MEDIA_ROOT. Use a trailing slash.
  95. # https://docs.djangoproject.com/en/2.0/ref/settings/#media-url
  96. MEDIA_URL = '/media/'
  97.  
  98. # Absolute path to the directory static files should be collected to.
  99. # Don't put anything in this directory yourself; store your static files
  100. # in apps' "static/" subdirectories and in STATICFILES_DIRS.
  101. # https://docs.djangoproject.com/en/2.0/ref/settings/#static-root
  102. STATIC_ROOT = os.path.join(PROJECT_ROOT, 'public/static')
  103.  
  104. # URL prefix for static files.
  105. # https://docs.djangoproject.com/en/2.0/ref/settings/#static-url
  106. STATIC_URL = '/static/'
  107.  
  108. # Additional locations of static files
  109. # https://docs.djangoproject.com/en/2.0/ref/settings/#staticfiles-dirs
  110. STATICFILES_DIRS = (
  111.     os.path.join(BASE_DIR, 'static'),
  112. )
  113.  
  114. # TEMPLATE SETTINGS
  115. # https://docs.djangoproject.com/en/2.0/ref/settings/#templates
  116. TEMPLATES = [
  117.     {
  118.         'BACKEND': 'django.template.backends.django.DjangoTemplates',
  119.         'DIRS': [os.path.join(BASE_DIR, 'templates')],
  120.         'APP_DIRS': True,
  121.         'OPTIONS': {
  122.             'context_processors': [
  123.                 'django.contrib.auth.context_processors.auth',
  124.                 'django.template.context_processors.debug',
  125.                 'django.template.context_processors.request',
  126.                 'django.contrib.auth.context_processors.auth',
  127.                 'django.contrib.messages.context_processors.messages'
  128.             ],
  129.         },
  130.     },
  131. ]
  132.  
  133.  
  134. # URL SETTINGS
  135. # https://docs.djangoproject.com/en/2.0/ref/settings/#root-urlconf.
  136. ROOT_URLCONF = 'DzenanElvir.urls'
  137.  
  138.  
  139. # MIDDLEWARE SETTINGS
  140. # See: https://docs.djangoproject.com/en/2.0/ref/settings/#middleware
  141. MIDDLEWARE = [
  142.     'django.middleware.security.SecurityMiddleware',
  143.     'django.contrib.sessions.middleware.SessionMiddleware',
  144.     'django.middleware.common.CommonMiddleware',
  145.     'django.middleware.csrf.CsrfViewMiddleware',
  146.     'django.contrib.auth.middleware.AuthenticationMiddleware',
  147.     'django.contrib.messages.middleware.MessageMiddleware',
  148.     'django.middleware.clickjacking.XFrameOptionsMiddleware',
  149. ]
  150.  
  151. # LOGGING
  152. # https://docs.djangoproject.com/en/2.0/topics/logging/
  153. LOGGING = {
  154.     'version': 1,
  155.     'loggers': {
  156.         'DzenanElvir': {
  157.             'level': "DEBUG"
  158.         }
  159.     }
  160. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement