· 7 years ago · May 20, 2018, 05:16 PM
1"""
2Django settings for pet4you project.
3
4Generated by 'django-admin startproject' using Django 2.0.4.
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 = ''
24
25# SECURITY WARNING: don't run with debug turned on in production!
26DEBUG = True
27
28ALLOWED_HOSTS = ['*']
29
30
31# Application definition
32
33INSTALLED_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 'rest_framework.authtoken',
42 'corsheaders',
43 'other',
44 'account',
45 'brood'
46]
47
48
49REST_FRAMEWORK = {
50 'DEFAULT_PARSER_CLASSES': (
51 'rest_framework.parsers.JSONParser',
52 ),
53 'DEFAULT_AUTHENTICATION_CLASSES': (
54 'rest_framework.authentication.BasicAuthentication',
55 'rest_framework.authentication.TokenAuthentication',
56 )
57}
58
59MIDDLEWARE = [
60 'corsheaders.middleware.CorsMiddleware',
61 'django.middleware.common.CommonMiddleware',
62 'django.middleware.security.SecurityMiddleware',
63 'django.contrib.sessions.middleware.SessionMiddleware',
64 'django.middleware.csrf.CsrfViewMiddleware',
65 'django.contrib.auth.middleware.AuthenticationMiddleware',
66 'django.contrib.messages.middleware.MessageMiddleware',
67 'django.middleware.clickjacking.XFrameOptionsMiddleware',
68]
69
70ROOT_URLCONF = 'site.urls'
71
72TEMPLATES = [
73 {
74 'BACKEND': 'django.template.backends.django.DjangoTemplates',
75 'DIRS': [],
76 'APP_DIRS': True,
77 'OPTIONS': {
78 'context_processors': [
79 'django.template.context_processors.debug',
80 'django.template.context_processors.request',
81 'django.template.context_processors.media',
82 'django.contrib.auth.context_processors.auth',
83 'django.contrib.messages.context_processors.messages',
84 ],
85 },
86 },
87]
88
89WSGI_APPLICATION = 'site.wsgi.application'
90
91
92# Database
93# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
94
95DATABASES = {
96 'default': {
97 'ENGINE': 'django.db.backends.sqlite3',
98 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
99 }
100}
101
102BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
103
104TEMPLATES = [
105 {
106 'BACKEND': 'django.template.backends.django.DjangoTemplates',
107 'DIRS': [
108 os.path.join(BASE_DIR, 'build')
109 ],
110 'APP_DIRS': True,
111 'OPTIONS': {
112 'context_processors': [
113 'django.template.context_processors.debug',
114 'django.template.context_processors.request',
115 'django.contrib.auth.context_processors.auth',
116 'django.contrib.messages.context_processors.messages',
117 ],
118 },
119 },
120]
121
122
123CORS_ORIGIN_ALLOW_ALL = True
124CORS_ALLOW_CREDENTIALS = True
125
126CORS_ORIGIN_WHITELIST = (
127 'localhost:3000',
128)
129CORS_ORIGIN_REGEX_WHITELIST = (
130 'localhost:3000',
131)
132
133# Password validation
134# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
135
136AUTH_PASSWORD_VALIDATORS = [
137 {
138 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
139 },
140 {
141 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
142 },
143 {
144 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
145 },
146 {
147 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
148 },
149]
150
151
152# Internationalization
153# https://docs.djangoproject.com/en/2.0/topics/i18n/
154
155LANGUAGE_CODE = 'en-us'
156
157TIME_ZONE = 'UTC'
158
159USE_I18N = True
160
161USE_L10N = True
162
163USE_TZ = True
164
165
166# Static files (CSS, JavaScript, Images)
167# https://docs.djangoproject.com/en/2.0/howto/static-files/
168
169STATICFILES_DIRS = (
170 '/home/developer1/public_html/site/staticfiles/',
171 '/home/developer1/public_html/site/media/',
172)
173
174STATIC_URL = '/static/'
175MEDIA_URL = '/media/'
176
177STATICFILES_DIRS = [
178 os.path.join(BASE_DIR, 'build/static'),
179]
180
181STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
182MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
183
184STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'