· 6 years ago · Oct 22, 2019, 06:14 PM
1"""
2Django settings for Kotics project.
3
4Generated by 'django-admin startproject' using Django 2.2.1.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/2.2/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/2.2/ref/settings/
11"""
12
13import os
14
15# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
18# Quick-start development settings - unsuitable for production
19# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
20
21# SECURITY WARNING: keep the secret key used in production secret!
22SECRET_KEY = ''
23
24# SECURITY WARNING: don't run with debug turned on in production!
25DEBUG = True
26
27COMPRESS_ENABLED = True
28
29LOGIN_REDIRECT_URL = '/profile/'
30
31ALLOWED_HOSTS = ['*']
32
33# Application definition
34
35ACCOUNT_ACTIVATION_DAYS = 2 # кол-во дней для хранения кода активации
36
37AUTH_USER_EMAIL_UNIQUE = True
38EMAIL_HOST = 'localhost'
39EMAIL_PORT = 1025
40EMAIL_HOST_USER = ''
41EMAIL_HOST_PASSWORD = ''
42EMAIL_USE_TLS = False
43DEFAULT_FROM_EMAIL = 'info@google.ru'
44
45INSTALLED_APPS = [
46 'django.contrib.admin',
47 'django.contrib.auth',
48 'django.contrib.contenttypes',
49 'django.contrib.sessions',
50 'django.contrib.messages',
51 'django.contrib.staticfiles',
52 'rest_framework',
53 'image_optimizer',
54 "compressor",
55 'web',
56]
57
58EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
59
60REST_FRAMEWORK = {
61 'DEFAULT_PERMISSION_CLASSES': [
62 'rest_framework.permissions.AllowAny'
63 ]
64}
65
66MIDDLEWARE = [
67 'django.middleware.security.SecurityMiddleware',
68 'django.contrib.sessions.middleware.SessionMiddleware',
69 'django.middleware.common.CommonMiddleware',
70 'django.middleware.csrf.CsrfViewMiddleware',
71 'django.contrib.auth.middleware.AuthenticationMiddleware',
72 'django.contrib.messages.middleware.MessageMiddleware',
73 'django.middleware.clickjacking.XFrameOptionsMiddleware',
74]
75
76ROOT_URLCONF = 'Kotics.urls'
77
78TEMPLATES = [
79 {
80 'BACKEND': 'django.template.backends.django.DjangoTemplates',
81 'DIRS': [os.path.join(BASE_DIR, 'templates')],
82 'APP_DIRS': True,
83 'OPTIONS': {
84 'context_processors': [
85 'django.template.context_processors.debug',
86 'django.template.context_processors.request',
87 'django.contrib.auth.context_processors.auth',
88 'django.contrib.messages.context_processors.messages',
89 ],
90 },
91 },
92]
93
94WSGI_APPLICATION = 'Kotics.wsgi.application'
95
96# Database
97# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
98
99DATABASES = {
100 'default': {
101 'ENGINE': 'django.db.backends.sqlite3',
102 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
103 }
104}
105
106# Password validation
107# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
108
109AUTH_PASSWORD_VALIDATORS = [
110 {
111 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
112 },
113 {
114 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
115 },
116 {
117 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
118 },
119 {
120 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
121 },
122]
123
124# Internationalization
125# https://docs.djangoproject.com/en/2.2/topics/i18n/
126
127LANGUAGE_CODE = 'ru-RU'
128
129TIME_ZONE = 'UTC'
130
131USE_I18N = True
132
133USE_L10N = True
134
135USE_TZ = True
136
137# Static files (CSS, JavaScript, Images)
138# https://docs.djangoproject.com/en/2.2/howto/static-files/
139
140STATICFILES_DIRS = [
141 os.path.join(BASE_DIR, "static"),
142]
143
144MEDIA_URL = '/media/'
145MEDIA_ROOT = os.path.join(BASE_DIR, "media")
146STATIC_URL = '/static/'
147STATIC_ROOT = '../static/'
148
149OPTIMIZED_IMAGE_METHOD = 'pillow'
150
151STATICFILES_FINDERS = (
152 'django.contrib.staticfiles.finders.FileSystemFinder',
153 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
154 'compressor.finders.CompressorFinder',
155)
156
157COMPRESS_FILTERS = (
158 {
159 'css': ['compressor.filters.cssmin.CSSCompressorFilter'],
160 'js': ['compressor.filters.jsmin.JSMinFilter']
161 }
162)