· 9 years ago · Aug 29, 2016, 11:16 AM
1"""
2Django settings for nahar project.
3
4Generated by 'django-admin startproject' using Django 1.10.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/1.10/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/1.10/ref/settings/
11"""
12
13
14
15import environ
16root = environ.Path(__file__) - 2 # three folder back (/a/b/c/ - 3 = /)
17env = environ.Env(DEBUG=(bool, False),) # set default values and casting
18environ.Env.read_env() # reading .env file
19
20SITE_ROOT = root()
21
22DEBUG = env('DEBUG') # False if not in os.environ
23TEMPLATE_DEBUG = DEBUG
24
25
26import os
27
28# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
29BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
30
31
32# Quick-start development settings - unsuitable for production
33# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
34
35# SECURITY WARNING: keep the secret key used in production secret!
36SECRET_KEY = 'd)3mhox3dia3th0uedrg8$h1-z81(=h@@i_mp9&r2f4f(f_09$'
37# SECRET_KEY = env('SECRET_KEY')
38
39# SECURITY WARNING: don't run with debug turned on in production!
40# DEBUG = True
41
42ALLOWED_HOSTS = []
43
44
45# Application definition
46
47INSTALLED_APPS = [
48 # 'cms.society.apps.contact',
49 'django.contrib.admin',
50 'django.contrib.auth',
51 'django.contrib.contenttypes',
52 'django.contrib.sessions',
53 'django.contrib.messages',
54 'django.contrib.staticfiles',
55
56 #third party#
57 'rest_framework',
58 'rest_framework.authtoken',
59
60 #local APPS#
61 # 'account',
62 'accounts',
63 'booking',
64 'contacts',
65 'events',
66 'masters',
67 #'society',
68
69
70]
71
72MIDDLEWARE = [
73 'django.middleware.security.SecurityMiddleware',
74 'django.contrib.sessions.middleware.SessionMiddleware',
75 'django.middleware.common.CommonMiddleware',
76 'django.middleware.csrf.CsrfViewMiddleware',
77 'django.contrib.auth.middleware.AuthenticationMiddleware',
78 'django.contrib.messages.middleware.MessageMiddleware',
79 'django.middleware.clickjacking.XFrameOptionsMiddleware',
80]
81
82ROOT_URLCONF = 'nahar.urls'
83
84TEMPLATES = [
85 {
86 'BACKEND': 'django.template.backends.django.DjangoTemplates',
87 'DIRS': [os.path.join(BASE_DIR, 'templates')],
88 'APP_DIRS': True,
89 'OPTIONS': {
90 'context_processors': [
91 'django.template.context_processors.debug',
92 'django.template.context_processors.request',
93 'django.contrib.auth.context_processors.auth',
94 'django.contrib.messages.context_processors.messages',
95 ],
96 },
97 },
98]
99
100WSGI_APPLICATION = 'nahar.wsgi.application'
101
102
103# Database
104# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
105
106# DATABASES = {
107# 'default': {
108# 'ENGINE': 'django.db.backends.sqlite3',
109# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
110# }
111# }
112DATABASES = {
113 'default': env.db(),
114}
115
116# Password validation
117# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
118
119AUTH_PASSWORD_VALIDATORS = [
120 {
121 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
122 },
123 {
124 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
125 },
126 {
127 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
128 },
129 {
130 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
131 },
132]
133
134
135# Internationalization
136# https://docs.djangoproject.com/en/1.10/topics/i18n/
137
138LANGUAGE_CODE = 'en-us'
139
140TIME_ZONE = 'UTC'
141
142USE_I18N = True
143
144USE_L10N = True
145
146USE_TZ = True
147
148
149# Static files (CSS, JavaScript, Images)
150# https://docs.djangoproject.com/en/1.10/howto/static-files/
151
152STATIC_URL = '/static/'
153
154REST_FRAMEWORK = {
155 'DEFAULT_PERMISSION_CLASSES': (
156 'rest_framework.permissions.IsAuthenticated',
157 ),
158 'DEFAULT_RENDERER_CLASSES': (
159 'rest_framework.renderers.JSONRenderer',
160 'rest_framework.renderers.BrowsableAPIRenderer',
161 ),
162 # 'DEFAULT_PARSER_CLASSES': (
163 # 'rest_framework.parsers.JSONParser',
164 # )
165 "DEFAULT_AUTHENTICATION_CLASSES": (
166 'rest_framework.authentication.SessionAuthentication',
167 'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
168 'rest_framework.authentication.BasicAuthentication'
169
170 ),
171 # "DEFAULT_PERMISSION_CLASSES": (
172 # 'rest_framework.permissions.IsAuthenticated',
173 # #'rest_framework.permissions.IsAuthenticatedOrReadOnly',
174 # )
175}