· 6 years ago · May 30, 2019, 07:48 PM
1"""
2Django settings for FoodSquare project.
3
4Generated by 'django-admin startproject' using Django 2.2.1.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/2.1/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/2.1/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# Quick-start development settings - unsuitable for production
19# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
20
21# SECURITY WARNING: keep the secret key used in production secret!
22SECRET_KEY = '=%m4l_6pi$++(nf7th-z(dz)f(!uwhv&dm1w*5t*l37m+09wlx'
23
24# SECURITY WARNING: don't run with debug turned on in production!
25DEBUG = True
26
27ALLOWED_HOSTS = ['localhost', '127.0.0.1']
28
29# Application definition
30
31INSTALLED_APPS = [
32 'django.contrib.admin',
33 'django.contrib.auth',
34 'django.contrib.contenttypes',
35 'django.contrib.sessions',
36 'django.contrib.messages',
37 'django.contrib.staticfiles',
38 'django.contrib.sites',
39
40 'rest_framework',
41 'accounts.apps.AccountsConfig',
42 'browse',
43 # 'accounts',
44 'debug_toolbar',
45
46
47 'django_extensions',
48
49
50 'allauth',
51 'allauth.account',
52 'allauth.socialaccount',
53 'allauth.socialaccount.providers.facebook',
54 'allauth.socialaccount.providers.google',
55
56]
57
58ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
59
60
61MIDDLEWARE = [
62 'django.middleware.security.SecurityMiddleware',
63 'django.contrib.sessions.middleware.SessionMiddleware',
64 'django.middleware.common.CommonMiddleware',
65 'django.middleware.csrf.CsrfViewMiddleware',
66 'django.contrib.auth.middleware.AuthenticationMiddleware',
67 'django.contrib.messages.middleware.MessageMiddleware',
68 'django.middleware.clickjacking.XFrameOptionsMiddleware',
69 'debug_toolbar.middleware.DebugToolbarMiddleware',
70]
71
72ROOT_URLCONF = 'Foodsquare.urls'
73
74TEMPLATES = [
75 {
76 'BACKEND': 'django.template.backends.django.DjangoTemplates',
77 'DIRS': [],
78 'APP_DIRS': True,
79 'OPTIONS': {
80 'context_processors': [
81 'django.template.context_processors.debug',
82 'django.template.context_processors.request',
83 'django.contrib.auth.context_processors.auth',
84 'django.contrib.messages.context_processors.messages',
85 ],
86 },
87 },
88]
89
90WSGI_APPLICATION = 'Foodsquare.wsgi.application'
91
92# Database
93# https://docs.djangoproject.com/en/2.1/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
102# Password validation
103# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
104
105AUTH_PASSWORD_VALIDATORS = [
106 {
107 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
108 },
109 {
110 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
111 },
112 {
113 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
114 },
115 {
116 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
117 },
118]
119
120# Internationalization
121# https://docs.djangoproject.com/en/2.1/topics/i18n/
122
123LANGUAGE_CODE = 'en-us'
124
125TIME_ZONE = 'UTC'
126
127USE_I18N = True
128
129USE_L10N = True
130
131USE_TZ = True
132
133# Static files (CSS, JavaScript, Images)
134# https://docs.djangoproject.com/en/2.1/howto/static-files/
135
136AUTHENTICATION_BACKENDS = (
137 "django.contrib.auth.backends.ModelBackend",
138 "allauth.account.auth_backends.AuthenticationBackend",
139)
140
141SOCIALACCOUNT_PROVIDERS = \
142 {'facebook':
143 {'METHOD': 'oauth2',
144 'SCOPE': ['email','public_profile', 'user_friends'],
145 'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
146 'FIELDS': [
147 'id',
148 'email',
149 'name',
150 'first_name',
151 'last_name',
152 'verified',
153 'locale',
154 'timezone',
155 'link',
156 'gender',
157 'updated_time'],
158 'EXCHANGE_TOKEN': True,
159 'LOCALE_FUNC': lambda request: 'kr_KR',
160 'VERIFIED_EMAIL': False,
161 'VERSION': 'v2.4'}}
162
163STATIC_URL = '/static/'
164SITE_ID = 1