settings.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. """
  2. Django settings for launcher project.
  3. Generated by 'django-admin startproject' using Django 2.2.4.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/2.2/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/2.2/ref/settings/
  8. """
  9. import os
  10. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  11. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  12. # Quick-start development settings - unsuitable for production
  13. # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
  14. # SECURITY WARNING: keep the secret key used in production secret!
  15. SECRET_KEY = 'a(wm02y7+q^voeqj9i8w&9*ryvtn0gg3bo$-k=()oz!8+5_okg'
  16. # SECURITY WARNING: don't run with debug turned on in production!
  17. DEBUG = True
  18. ALLOWED_HOSTS = ["localhost", "127.0.0.1"]
  19. # Application definition
  20. INSTALLED_APPS = [
  21. 'django.contrib.admin',
  22. 'django.contrib.auth',
  23. 'django.contrib.contenttypes',
  24. 'django.contrib.sessions',
  25. 'django.contrib.messages',
  26. 'django.contrib.staticfiles',
  27. 'links'
  28. ]
  29. MIDDLEWARE = [
  30. 'django.middleware.security.SecurityMiddleware',
  31. 'django.contrib.sessions.middleware.SessionMiddleware',
  32. 'django.middleware.common.CommonMiddleware',
  33. 'django.middleware.csrf.CsrfViewMiddleware',
  34. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  35. 'django.contrib.messages.middleware.MessageMiddleware',
  36. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  37. ]
  38. ROOT_URLCONF = 'launcher.urls'
  39. TEMPLATES = [
  40. {
  41. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  42. 'DIRS': [],
  43. 'APP_DIRS': True,
  44. 'OPTIONS': {
  45. 'context_processors': [
  46. 'django.template.context_processors.debug',
  47. 'django.template.context_processors.request',
  48. 'django.contrib.auth.context_processors.auth',
  49. 'django.contrib.messages.context_processors.messages',
  50. ],
  51. },
  52. },
  53. ]
  54. WSGI_APPLICATION = 'launcher.wsgi.application'
  55. # Database
  56. # https://docs.djangoproject.com/en/2.2/ref/settings/#databases
  57. DATABASES = {
  58. 'default': {
  59. 'ENGINE': 'django.db.backends.sqlite3',
  60. 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  61. }
  62. }
  63. # Password validation
  64. # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
  65. AUTH_PASSWORD_VALIDATORS = [
  66. {
  67. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  68. },
  69. {
  70. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  71. },
  72. {
  73. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  74. },
  75. {
  76. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  77. },
  78. ]
  79. # Internationalization
  80. # https://docs.djangoproject.com/en/2.2/topics/i18n/
  81. LANGUAGE_CODE = 'en-us'
  82. TIME_ZONE = 'UTC'
  83. USE_I18N = True
  84. USE_L10N = True
  85. USE_TZ = True
  86. # Static files (CSS, JavaScript, Images)
  87. # https://docs.djangoproject.com/en/2.2/howto/static-files/
  88. STATIC_URL = '/static/'
  89. STATICFILES_DIRS = (
  90. os.path.join(BASE_DIR, 'static'),
  91. )
  92. MEDIA_ROOT = "media/"
  93. MEDIA_URL = "media/"
  94. # env variables
  95. WEB_PREFIX_URL_KEY = 'WEB_PREFIX_URL'
  96. WEB_PREFIX_URL = os.environ.get(WEB_PREFIX_URL_KEY) \
  97. if os.environ.get(WEB_PREFIX_URL_KEY) is not None else ''