settings.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. from pathlib import Path
  2. from django.urls import reverse_lazy
  3. BASE_DIR = Path(__file__).resolve().parent.parent
  4. SECRET_KEY = 'django-insecure-7)dgs++2!#==aye4rd=5)c)bw0eokiyqx0hts6#t80!$c&$s+('
  5. DEBUG = True
  6. ALLOWED_HOSTS = ['localhost', '127.0.0.1']
  7. INSTALLED_APPS = [
  8. 'django.contrib.admin',
  9. 'django.contrib.auth',
  10. 'django.contrib.contenttypes',
  11. 'django.contrib.sessions',
  12. 'django.contrib.messages',
  13. 'django.contrib.staticfiles',
  14. 'news.apps.NewsConfig',
  15. ]
  16. MIDDLEWARE = [
  17. 'django.middleware.security.SecurityMiddleware',
  18. 'django.contrib.sessions.middleware.SessionMiddleware',
  19. 'django.middleware.common.CommonMiddleware',
  20. 'django.middleware.csrf.CsrfViewMiddleware',
  21. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  22. 'django.contrib.messages.middleware.MessageMiddleware',
  23. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  24. ]
  25. ROOT_URLCONF = 'yanews.urls'
  26. TEMPLATES = [
  27. {
  28. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  29. 'DIRS': [BASE_DIR / 'templates'],
  30. 'APP_DIRS': True,
  31. 'OPTIONS': {
  32. 'context_processors': [
  33. 'django.template.context_processors.debug',
  34. 'django.template.context_processors.request',
  35. 'django.contrib.auth.context_processors.auth',
  36. 'django.contrib.messages.context_processors.messages',
  37. ],
  38. },
  39. },
  40. ]
  41. WSGI_APPLICATION = 'yanews.wsgi.application'
  42. DATABASES = {
  43. 'default': {
  44. 'ENGINE': 'django.db.backends.sqlite3',
  45. 'NAME': BASE_DIR / 'db.sqlite3',
  46. }
  47. }
  48. AUTH_PASSWORD_VALIDATORS = []
  49. LANGUAGE_CODE = 'ru'
  50. TIME_ZONE = 'Europe/Moscow'
  51. USE_I18N = True
  52. USE_L10N = True
  53. USE_TZ = True
  54. STATIC_URL = '/static/'
  55. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
  56. LOGIN_URL = reverse_lazy('users:login')
  57. LOGIN_REDIRECT_URL = reverse_lazy('news:home')
  58. NEWS_COUNT_ON_HOME_PAGE = 10