|
1 |
| -# Django settings for tutorial project. |
| 1 | +""" |
| 2 | +Django settings for tutorial project. |
2 | 3 |
|
3 |
| -DEBUG = True |
4 |
| -TEMPLATE_DEBUG = DEBUG |
| 4 | +Generated by 'django-admin startproject' using Django 1.10.2. |
5 | 5 |
|
6 |
| -ADMINS = ( |
7 |
| - # ('Your Name', '[email protected]'), |
8 |
| -) |
| 6 | +For more information on this file, see |
| 7 | +https://docs.djangoproject.com/en/1.10/topics/settings/ |
9 | 8 |
|
10 |
| -MANAGERS = ADMINS |
| 9 | +For the full list of settings and their values, see |
| 10 | +https://docs.djangoproject.com/en/1.10/ref/settings/ |
| 11 | +""" |
11 | 12 |
|
12 |
| -DATABASES = { |
13 |
| - 'default': { |
14 |
| - 'ENGINE': 'django.db.backends.sqlite3', # Or use an alternate database backend. |
15 |
| - 'NAME': 'tmp.db', # Path to sqlite3 database file. |
16 |
| - 'USER': '', # Not used with sqlite3. |
17 |
| - 'PASSWORD': '', # Not used with sqlite3. |
18 |
| - 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. |
19 |
| - 'PORT': '', # Set to empty string for default. Not used with sqlite3. |
20 |
| - } |
21 |
| -} |
| 13 | +import os |
22 | 14 |
|
23 |
| -# Local time zone for this installation. Choices can be found here: |
24 |
| -# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name |
25 |
| -# although not all choices may be available on all operating systems. |
26 |
| -# In a Windows environment this must be set to your system time zone. |
27 |
| -TIME_ZONE = 'America/Chicago' |
| 15 | +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) |
| 16 | +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
28 | 17 |
|
29 |
| -# Language code for this installation. All choices can be found here: |
30 |
| -# http://www.i18nguy.com/unicode/language-identifiers.html |
31 |
| -LANGUAGE_CODE = 'en-us' |
32 | 18 |
|
33 |
| -SITE_ID = 1 |
| 19 | +# Quick-start development settings - unsuitable for production |
| 20 | +# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/ |
34 | 21 |
|
35 |
| -# If you set this to False, Django will make some optimizations so as not |
36 |
| -# to load the internationalization machinery. |
37 |
| -USE_I18N = True |
| 22 | +# SECURITY WARNING: keep the secret key used in production secret! |
| 23 | +SECRET_KEY = 'us%!@&39o250e79)l!4*0ac4oquo+^nm83vp#y%mw9i$7)i&fy' |
38 | 24 |
|
39 |
| -# If you set this to False, Django will not format dates, numbers and |
40 |
| -# calendars according to the current locale. |
41 |
| -USE_L10N = True |
| 25 | +# SECURITY WARNING: don't run with debug turned on in production! |
| 26 | +DEBUG = True |
42 | 27 |
|
43 |
| -# If you set this to False, Django will not use timezone-aware datetimes. |
44 |
| -USE_TZ = True |
| 28 | +ALLOWED_HOSTS = [] |
45 | 29 |
|
46 |
| -# Absolute filesystem path to the directory that will hold user-uploaded files. |
47 |
| -# Example: "/home/media/media.lawrence.com/media/" |
48 |
| -MEDIA_ROOT = '' |
49 | 30 |
|
50 |
| -# URL that handles the media served from MEDIA_ROOT. Make sure to use a |
51 |
| -# trailing slash. |
52 |
| -# Examples: "http://media.lawrence.com/media/", "http://example.com/media/" |
53 |
| -MEDIA_URL = '' |
| 31 | +# Application definition |
54 | 32 |
|
55 |
| -# Absolute path to the directory static files should be collected to. |
56 |
| -# Don't put anything in this directory yourself; store your static files |
57 |
| -# in apps' "static/" subdirectories and in STATICFILES_DIRS. |
58 |
| -# Example: "/home/media/media.lawrence.com/static/" |
59 |
| -STATIC_ROOT = '' |
| 33 | +INSTALLED_APPS = [ |
| 34 | + 'django.contrib.admin', |
| 35 | + 'django.contrib.auth', |
| 36 | + 'django.contrib.contenttypes', |
| 37 | + 'django.contrib.sessions', |
| 38 | + 'django.contrib.messages', |
| 39 | + 'django.contrib.staticfiles', |
| 40 | + 'rest_framework', |
| 41 | +] |
60 | 42 |
|
61 |
| -# URL prefix for static files. |
62 |
| -# Example: "http://media.lawrence.com/static/" |
63 |
| -STATIC_URL = '/static/' |
| 43 | +REST_FRAMEWORK = { |
| 44 | + 'DEFAULT_PERMISSION_CLASSES': [ |
| 45 | + 'rest_framework.permissions.IsAdminUser', |
| 46 | + ], |
| 47 | + 'PAGE_SIZE': 10 |
| 48 | +} |
64 | 49 |
|
65 |
| -# Additional locations of static files |
66 |
| -STATICFILES_DIRS = ( |
67 |
| - # Put strings here, like "/home/html/static" or "C:/www/django/static". |
68 |
| - # Always use forward slashes, even on Windows. |
69 |
| - # Don't forget to use absolute paths, not relative paths. |
70 |
| -) |
71 |
| - |
72 |
| -# List of finder classes that know how to find static files in |
73 |
| -# various locations. |
74 |
| -STATICFILES_FINDERS = ( |
75 |
| - 'django.contrib.staticfiles.finders.FileSystemFinder', |
76 |
| - 'django.contrib.staticfiles.finders.AppDirectoriesFinder', |
77 |
| -# 'django.contrib.staticfiles.finders.DefaultStorageFinder', |
78 |
| -) |
79 |
| - |
80 |
| -# Make this unique, and don't share it with anybody. |
81 |
| -SECRET_KEY = '98s9du5ruv!j%shx0udb#uz1g@v^xl65zm1l-_5%8cs6%c*qm$' |
82 |
| - |
83 |
| -# List of callables that know how to import templates from various sources. |
84 |
| -TEMPLATE_LOADERS = ( |
85 |
| - 'django.template.loaders.filesystem.Loader', |
86 |
| - 'django.template.loaders.app_directories.Loader', |
87 |
| -# 'django.template.loaders.eggs.Loader', |
88 |
| -) |
89 |
| - |
90 |
| -MIDDLEWARE_CLASSES = ( |
91 |
| - 'django.middleware.common.CommonMiddleware', |
| 50 | +MIDDLEWARE = [ |
| 51 | + 'django.middleware.security.SecurityMiddleware', |
92 | 52 | 'django.contrib.sessions.middleware.SessionMiddleware',
|
| 53 | + 'django.middleware.common.CommonMiddleware', |
93 | 54 | 'django.middleware.csrf.CsrfViewMiddleware',
|
94 | 55 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
|
95 | 56 | 'django.contrib.messages.middleware.MessageMiddleware',
|
96 |
| - # Uncomment the next line for simple clickjacking protection: |
97 |
| - # 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
98 |
| -) |
| 57 | + 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
| 58 | +] |
99 | 59 |
|
100 | 60 | ROOT_URLCONF = 'tutorial.urls'
|
101 | 61 |
|
102 |
| -# Python dotted path to the WSGI application used by Django's runserver. |
| 62 | +TEMPLATES = [ |
| 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 | + |
103 | 78 | WSGI_APPLICATION = 'tutorial.wsgi.application'
|
104 | 79 |
|
105 |
| -TEMPLATE_DIRS = ( |
106 |
| - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". |
107 |
| - # Always use forward slashes, even on Windows. |
108 |
| - # Don't forget to use absolute paths, not relative paths. |
109 |
| -) |
110 | 80 |
|
111 |
| -INSTALLED_APPS = ( |
112 |
| - 'django.contrib.auth', |
113 |
| - 'django.contrib.contenttypes', |
114 |
| - 'django.contrib.sessions', |
115 |
| - 'django.contrib.sites', |
116 |
| - 'django.contrib.messages', |
117 |
| - 'django.contrib.staticfiles', |
118 |
| - # Uncomment the next line to enable the admin: |
119 |
| - # 'django.contrib.admin', |
120 |
| - # Uncomment the next line to enable admin documentation: |
121 |
| - # 'django.contrib.admindocs', |
122 |
| - 'rest_framework', |
123 |
| - 'snippets', |
124 |
| -) |
125 |
| - |
126 |
| -# A sample logging configuration. The only tangible logging |
127 |
| -# performed by this configuration is to send an email to |
128 |
| -# the site admins on every HTTP 500 error when DEBUG=False. |
129 |
| -# See http://docs.djangoproject.com/en/dev/topics/logging for |
130 |
| -# more details on how to customize your logging configuration. |
131 |
| -LOGGING = { |
132 |
| - 'version': 1, |
133 |
| - 'disable_existing_loggers': False, |
134 |
| - 'filters': { |
135 |
| - 'require_debug_false': { |
136 |
| - '()': 'django.utils.log.RequireDebugFalse' |
137 |
| - } |
138 |
| - }, |
139 |
| - 'handlers': { |
140 |
| - 'mail_admins': { |
141 |
| - 'level': 'ERROR', |
142 |
| - 'filters': ['require_debug_false'], |
143 |
| - 'class': 'django.utils.log.AdminEmailHandler' |
144 |
| - } |
145 |
| - }, |
146 |
| - 'loggers': { |
147 |
| - 'django.request': { |
148 |
| - 'handlers': ['mail_admins'], |
149 |
| - 'level': 'ERROR', |
150 |
| - 'propagate': True, |
151 |
| - }, |
| 81 | +# Database |
| 82 | +# https://docs.djangoproject.com/en/1.10/ref/settings/#databases |
| 83 | + |
| 84 | +DATABASES = { |
| 85 | + 'default': { |
| 86 | + 'ENGINE': 'django.db.backends.sqlite3', |
| 87 | + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), |
152 | 88 | }
|
153 | 89 | }
|
154 | 90 |
|
155 |
| -REST_FRAMEWORK = { |
156 |
| - 'PAGE_SIZE': 10, |
157 |
| -} |
158 | 91 |
|
159 |
| -import os |
160 |
| -if os.environ.get('HEROKU'): # heroku config:set HEROKU=1 |
161 |
| - import dj_database_url |
162 |
| - DATABASES['default'] = dj_database_url.config() |
| 92 | +# Password validation |
| 93 | +# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators |
| 94 | + |
| 95 | +AUTH_PASSWORD_VALIDATORS = [ |
| 96 | + { |
| 97 | + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', |
| 98 | + }, |
| 99 | + { |
| 100 | + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', |
| 101 | + }, |
| 102 | + { |
| 103 | + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', |
| 104 | + }, |
| 105 | + { |
| 106 | + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', |
| 107 | + }, |
| 108 | +] |
163 | 109 |
|
164 |
| -LOGIN_REDIRECT_URL = '/' |
| 110 | + |
| 111 | +# Internationalization |
| 112 | +# https://docs.djangoproject.com/en/1.10/topics/i18n/ |
| 113 | + |
| 114 | +LANGUAGE_CODE = 'en-us' |
| 115 | + |
| 116 | +TIME_ZONE = 'UTC' |
| 117 | + |
| 118 | +USE_I18N = True |
| 119 | + |
| 120 | +USE_L10N = True |
| 121 | + |
| 122 | +USE_TZ = True |
| 123 | + |
| 124 | + |
| 125 | +# Static files (CSS, JavaScript, Images) |
| 126 | +# https://docs.djangoproject.com/en/1.10/howto/static-files/ |
| 127 | + |
| 128 | +STATIC_URL = '/static/' |
0 commit comments