· 8 years ago · Jul 06, 2017, 02:40 PM
1"""
2Django settings for Restaurant project.
3
4Generated by 'django-admin startproject' using Django 1.11.3.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/1.11/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/1.11/ref/settings/
11"""
12
13import configparser
14import os
15
16# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
17BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
18
19# set directory with outlying configuration files
20CONF_ROOT = os.path.join(BASE_DIR, 'configurations')
21
22CONF_FILE = (os.path.join(CONF_ROOT, 'config.ini'))
23
24config = configparser.ConfigParser()
25config.read(CONF_FILE)
26
27# Quick-start development settings - unsuitable for production
28# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
29
30# SECURITY WARNING: keep the secret key used in production secret!
31SECRET_KEY = '9cgl0$gghgsh)dqp%b-onqnrf#lg%!igt0s)4qsefv*oz7=t#6'
32
33# SECURITY WARNING: don't run with debug turned on in production!
34DEBUG = True
35
36ALLOWED_HOSTS = ['127.0.0.1', 'localhost']
37
38
39# Application definition
40
41INSTALLED_APPS = [
42 'django.contrib.admin',
43 'django.contrib.auth',
44 'django.contrib.contenttypes',
45 'django.contrib.sessions',
46 'django.contrib.messages',
47 'django.contrib.staticfiles',
48]
49
50MIDDLEWARE = [
51 'django.middleware.security.SecurityMiddleware',
52 'django.contrib.sessions.middleware.SessionMiddleware',
53 'django.middleware.common.CommonMiddleware',
54 'django.middleware.csrf.CsrfViewMiddleware',
55 'django.contrib.auth.middleware.AuthenticationMiddleware',
56 'django.contrib.messages.middleware.MessageMiddleware',
57 'django.middleware.clickjacking.XFrameOptionsMiddleware',
58]
59
60ROOT_URLCONF = 'Restaurant.urls'
61
62TEMPLATES = [
63 {
64 'BACKEND': 'django.template.backends.django.DjangoTemplates',
65 'DIRS': [],
66 'APP_DIRS': True,
67 'OPTIONS': {
68 'context_processors': [
69 'django.template.context_processors.debug',
70 'django.template.context_processors.request',
71 'django.contrib.auth.context_processors.auth',
72 'django.contrib.messages.context_processors.messages',
73 ],
74 },
75 },
76]
77
78WSGI_APPLICATION = 'Restaurant.wsgi.application'
79
80
81# Database
82# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
83
84DB_ENGINE = config['PSQL']['ENGINE']
85DB_NAME = config['PSQL']['NAME']
86DB_USER = config['PSQL']['USER']
87DB_PASSWORD = config['PSQL']['PASSWORD']
88DB_HOST = config['PSQL']['HOST']
89DB_PORT = config['PSQL']['PORT']
90
91DATABASES = {
92 'default': {
93 'ENGINE': DB_ENGINE,
94 'NAME': DB_NAME,
95 'USER': DB_USER,
96 'PASSWORD': DB_PASSWORD,
97 'HOST': DB_HOST,
98 'PORT': DB_PORT,
99 }
100}
101
102
103# Password validation
104# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
105
106AUTH_PASSWORD_VALIDATORS = [
107 {
108 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
109 },
110 {
111 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
112 },
113 {
114 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
115 },
116 {
117 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
118 },
119]
120
121
122# Internationalization
123# https://docs.djangoproject.com/en/1.11/topics/i18n/
124
125LANGUAGE_CODE = 'en-us'
126
127TIME_ZONE = 'Europe/Kiev'
128
129USE_I18N = True
130
131USE_L10N = True
132
133USE_TZ = True
134
135
136# Static files (CSS, JavaScript, Images)
137# https://docs.djangoproject.com/en/1.11/howto/static-files/
138
139STATIC_URL = '/static/'
140STATIC_ROOT = os.path.join(BASE_DIR, 'static')