· 5 years ago · Mar 22, 2020, 04:44 PM
1"""
2Django settings for backend project.
3
4Generated by 'django-admin startproject' using Django 3.0.3.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/3.0/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/3.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/3.0/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = 'kigf#1y2c+l$&*av7m#fy#)fu5pd4#fbq+r!zjhyats9nn33%)'
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 'drf_yasg',
41 'rest_framework',
42 'item',
43 'category',
44 'order',
45 'pending_order',
46 'user',
47 'constants',
48 'error',
49 'article',
50 'rest_framework.authtoken',
51]
52
53MIDDLEWARE = [
54 'django.middleware.security.SecurityMiddleware',
55 'django.contrib.sessions.middleware.SessionMiddleware',
56 'django.middleware.common.CommonMiddleware',
57 'django.middleware.csrf.CsrfViewMiddleware',
58 'django.contrib.auth.middleware.AuthenticationMiddleware',
59 'django.contrib.messages.middleware.MessageMiddleware',
60 'django.middleware.clickjacking.XFrameOptionsMiddleware',
61]
62
63ROOT_URLCONF = 'backend.urls'
64
65TEMPLATES = [
66 {
67 'BACKEND': 'django.template.backends.django.DjangoTemplates',
68 'DIRS': [],
69 'APP_DIRS': True,
70 'OPTIONS': {
71 'context_processors': [
72 'django.template.context_processors.debug',
73 'django.template.context_processors.request',
74 'django.contrib.auth.context_processors.auth',
75 'django.contrib.messages.context_processors.messages',
76 ],
77 },
78 },
79]
80
81WSGI_APPLICATION = 'backend.wsgi.application'
82
83
84# Database
85# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
86
87DATABASES = {
88 'default': {
89 'ENGINE': 'django.db.backends.sqlite3',
90 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
91 }
92}
93
94
95# Password validation
96# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
97
98AUTH_PASSWORD_VALIDATORS = [
99 {
100 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
101 },
102 {
103 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
104 },
105 {
106 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
107 },
108 {
109 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
110 },
111]
112
113
114# Internationalization
115# https://docs.djangoproject.com/en/3.0/topics/i18n/
116
117LANGUAGE_CODE = 'en-us'
118
119TIME_ZONE = 'UTC'
120
121USE_I18N = True
122
123USE_L10N = True
124
125USE_TZ = True
126
127
128# Static files (CSS, JavaScript, Images)
129# https://docs.djangoproject.com/en/3.0/howto/static-files/
130
131STATIC_URL = '/static/'
132
133REST_FRAMEWORK = {
134 'DEFAULT_AUTHENTICATION_CLASSES': [
135 'rest_framework.authentication.TokenAuthentication',
136 ],
137 'DEFAULT_PERMISSION_CLASSES': (
138 'rest_framework.permissions.IsAuthenticated',
139 ),
140 'DEFAULT_MODEL_SERIALIZER_CLASS': (
141 'rest_framework.serializers.ModelSerializer',
142 ),
143 'DEFAULT_PARSER_CLASSES': (
144 'rest_framework.parsers.JSONParser',
145 'rest_framework.parsers.FormParser',
146 'rest_framework.parsers.MultiPartParser',
147 ),
148}