settings.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. """
  2. Django settings for filmbase project.
  3. Generated by 'django-admin startproject' using Django 4.1.3.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/4.1/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/4.1/ref/settings/
  8. """
  9. from pathlib import Path
  10. import os
  11. # Build paths inside the project like this: BASE_DIR / 'subdir'.
  12. BASE_DIR = Path(__file__).resolve().parent.parent
  13. # Quick-start development settings - unsuitable for production
  14. # See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
  15. # SECURITY WARNING: keep the secret key used in production secret!
  16. SECRET_KEY = 'django-insecure-2rpzj=38ke0iyv+lf351(!qsag#pj1-lw6gj(r*&c&fbum+=y&'
  17. # SECURITY WARNING: don't run with debug turned on in production!
  18. DEBUG = True
  19. ALLOWED_HOSTS = []
  20. # Application definition
  21. INSTALLED_APPS = [
  22. "films.apps.FilmsConfig",
  23. "signup.apps.SignupConfig",
  24. 'dal',
  25. 'dal_select2',
  26. 'django.contrib.admin',
  27. 'django.contrib.auth',
  28. 'django.contrib.contenttypes',
  29. 'django.contrib.sessions',
  30. 'django.contrib.messages',
  31. 'django.contrib.staticfiles',
  32. "debug_toolbar",
  33. "django_bootstrap5"
  34. ]
  35. MIDDLEWARE = [
  36. 'django.middleware.security.SecurityMiddleware',
  37. 'django.contrib.sessions.middleware.SessionMiddleware',
  38. 'django.middleware.common.CommonMiddleware',
  39. 'django.middleware.csrf.CsrfViewMiddleware',
  40. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  41. 'django.contrib.messages.middleware.MessageMiddleware',
  42. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  43. "debug_toolbar.middleware.DebugToolbarMiddleware",
  44. ]
  45. ROOT_URLCONF = 'filmbase.urls'
  46. TEMPLATES = [
  47. {
  48. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  49. 'DIRS': [BASE_DIR / "templates"],
  50. 'APP_DIRS': True,
  51. 'OPTIONS': {
  52. 'context_processors': [
  53. 'django.template.context_processors.debug',
  54. 'django.template.context_processors.request',
  55. 'django.contrib.auth.context_processors.auth',
  56. 'django.contrib.messages.context_processors.messages',
  57. ],
  58. },
  59. },
  60. ]
  61. WSGI_APPLICATION = 'filmbase.wsgi.application'
  62. # Database
  63. # https://docs.djangoproject.com/en/4.1/ref/settings/#databases
  64. DATABASES = {
  65. 'default': {
  66. 'ENGINE': 'django.db.backends.sqlite3',
  67. 'NAME': BASE_DIR / 'db.sqlite3',
  68. }
  69. }
  70. # Password validation
  71. # https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
  72. AUTH_PASSWORD_VALIDATORS = [
  73. {
  74. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  75. },
  76. {
  77. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  78. },
  79. {
  80. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  81. },
  82. {
  83. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  84. },
  85. ]
  86. # Internationalization
  87. # https://docs.djangoproject.com/en/4.1/topics/i18n/
  88. LANGUAGE_CODE = 'ru'
  89. TIME_ZONE = 'Europe/Moscow'
  90. USE_I18N = True
  91. USE_TZ = True
  92. # Static files (CSS, JavaScript, Images)
  93. # https://docs.djangoproject.com/en/4.1/howto/static-files/
  94. STATIC_URL = 'static/'
  95. STATIC_ROOT = os.path.join(BASE_DIR / "static_root")
  96. STATICFILES_DIRS = [BASE_DIR / "static"]
  97. # Default primary key field type
  98. # https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
  99. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
  100. INTERNAL_IPS = ["127.0.0.1"]
  101. MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
  102. MEDIA_URL = '/media/'
  103. LOGIN_REDIRECT_URL = 'films:home'