· 7 years ago · Feb 07, 2018, 10:06 PM
1"""
2Django settings for shmot project.
3
4Generated by 'django-admin startproject' using Django 2.0.1.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/2.0/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/2.0/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
19# Quick-start development settings - unsuitable for production
20# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = 't+0+*wo*!t_)dz@7_8jxep4$o7ef39mjrq%9v&0&=jya^g*w1e'
24
25# SECURITY WARNING: don't run with debug turned on in production!
26DEBUG = True
27
28ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'shmot.pythonanywhere.com']
29
30# Application definition
31
32INSTALLED_APPS = [
33 'userapp',
34 'mainapp.apps.MainappConfig',
35 'django.contrib.admin',
36 'django.contrib.auth',
37 'django.contrib.contenttypes',
38 'django.contrib.sessions',
39 'django.contrib.messages',
40 'django.contrib.staticfiles',
41]
42
43MIDDLEWARE = [
44 'django.middleware.security.SecurityMiddleware',
45 'django.contrib.sessions.middleware.SessionMiddleware',
46 'django.middleware.common.CommonMiddleware',
47 'django.middleware.csrf.CsrfViewMiddleware',
48 'django.contrib.auth.middleware.AuthenticationMiddleware',
49 'django.contrib.messages.middleware.MessageMiddleware',
50 'django.middleware.clickjacking.XFrameOptionsMiddleware',
51]
52
53ROOT_URLCONF = 'shmot.urls'
54
55TEMPLATES = [
56 {
57 'BACKEND': 'django.template.backends.django.DjangoTemplates',
58 'DIRS': [],
59 'APP_DIRS': True,
60 'OPTIONS': {
61 'context_processors': [
62 'django.template.context_processors.debug',
63 'django.template.context_processors.request',
64 'django.contrib.auth.context_processors.auth',
65 'django.contrib.messages.context_processors.messages',
66 ],
67 },
68 },
69]
70
71WSGI_APPLICATION = 'shmot.wsgi.application'
72
73
74# Database
75# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
76
77DATABASES = {
78 'default': {
79 'ENGINE': 'django.db.backends.postgresql_psycopg2',
80 'NAME': 'shmotdb', # Database name (Database -> schemas)
81 'USER': 'shmotuser', # Name of db user (must set while creating db)
82 'PASSWORD': '0001234', # User's password
83 'HOST': 'localhost',
84 'PORT': '',
85 }
86}
87
88
89# Password validation
90# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
91
92AUTH_PASSWORD_VALIDATORS = [
93 {
94 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
95 },
96 {
97 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
98 },
99 {
100 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
101 },
102 {
103 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
104 },
105]
106
107
108# Internationalization
109# https://docs.djangoproject.com/en/2.0/topics/i18n/
110
111LANGUAGE_CODE = 'ru-ru'
112
113TIME_ZONE = 'Europe/Moscow'
114
115USE_I18N = True
116
117USE_L10N = True
118
119USE_TZ = False
120
121
122# Static files (CSS, JavaScript, Images)
123# https://docs.djangoproject.com/en/2.0/howto/static-files/
124
125STATIC_URL = '/static/'
126#STATIC_ROOT = os.path.join(BASE_DIR, 'static')
127STATICFILES_DIRS = [
128 os.path.join(BASE_DIR, 'static'),
129]
130
131# Other stuff
132
133LOGIN_REDIRECT_URL = 'home'
134LOGOUT_REDIRECT_URL = 'home'
135
136EMAIL_BACKEND = "django.core.mail.backends.filebased.EmailBackend"
137EMAIL_FILE_PATH = os.path.join(BASE_DIR, "sent_emails")
138
139AUTH_USER_MODEL = 'userapp.CustomUser'
140
141APPEND_SLASH = True