settings.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import os
  2. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  3. # SECURITY WARNING: keep the secret key used in production secret!
  4. SECRET_KEY = 'k6(*@td)ld=ku!*v5vi@^f)tk1zu*=o1+%rqgazezq+klgzct6'
  5. # SECURITY WARNING: don't run with debug turned on in production!
  6. DEBUG = True
  7. ALLOWED_HOSTS = ['*']
  8. # Application definition
  9. INSTALLED_APPS = [
  10. 'django.contrib.admin',
  11. 'django.contrib.auth',
  12. 'django.contrib.contenttypes',
  13. 'django.contrib.sessions',
  14. 'django.contrib.messages',
  15. 'django.contrib.staticfiles',
  16. 'corsheaders',
  17. 'model'
  18. ]
  19. MIDDLEWARE = [
  20. 'django.middleware.security.SecurityMiddleware',
  21. 'django.contrib.sessions.middleware.SessionMiddleware',
  22. 'corsheaders.middleware.CorsMiddleware',
  23. 'django.middleware.common.CommonMiddleware',
  24. # 'django.middleware.csrf.CsrfViewMiddleware',
  25. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  26. 'django.contrib.messages.middleware.MessageMiddleware',
  27. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  28. ]
  29. ROOT_URLCONF = 'langer.urls'
  30. TEMPLATES = [
  31. {
  32. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  33. 'DIRS': [os.path.join(BASE_DIR, 'templates')]
  34. ,
  35. 'APP_DIRS': True,
  36. 'OPTIONS': {
  37. 'context_processors': [
  38. 'django.template.context_processors.debug',
  39. 'django.template.context_processors.request',
  40. 'django.contrib.auth.context_processors.auth',
  41. 'django.contrib.messages.context_processors.messages',
  42. ],
  43. },
  44. },
  45. ]
  46. WSGI_APPLICATION = 'langer.wsgi.application'
  47. # Database
  48. # https://docs.djangoproject.com/en/2.1/ref/settings/#databases
  49. DATABASES = {
  50. 'default': {
  51. 'ENGINE': 'django.db.backends.sqlite3',
  52. 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  53. }
  54. }
  55. # Password validation
  56. # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
  57. AUTH_PASSWORD_VALIDATORS = [
  58. {
  59. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  60. },
  61. {
  62. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  63. },
  64. {
  65. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  66. },
  67. {
  68. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  69. },
  70. ]
  71. # Internationalization
  72. # https://docs.djangoproject.com/en/2.1/topics/i18n/
  73. LANGUAGE_CODE = 'en-us'
  74. TIME_ZONE = 'UTC'
  75. USE_I18N = True
  76. USE_L10N = True
  77. USE_TZ = True
  78. # Static files (CSS, JavaScript, Images)
  79. # https://docs.djangoproject.com/en/2.1/howto/static-files/
  80. STATIC_URL = '/static/'
  81. CORS_ALLOW_METHODS = (
  82. 'GET',
  83. 'POST',
  84. 'PUT',
  85. 'PATCH',
  86. 'DELETE',
  87. 'OPTIONS'
  88. )
  89. CORS_ALLOW_HEADERS = (
  90. 'XMLHttpRequest',
  91. 'X_FILENAME',
  92. 'accept-encoding',
  93. 'authorization',
  94. 'content-type',
  95. 'dnt',
  96. 'origin',
  97. 'user-agent',
  98. 'x-csrftoken',
  99. 'x-requested-with',
  100. 'Pragma',
  101. )
  102. CORS_ALLOW_CREDENTIALS = True
  103. CORS_ORIGIN_ALLOW_ALL = True