· 5 years ago · Dec 10, 2019, 02:50 PM
1"""
2Django settings for app project.
3
4Generated by 'django-admin startproject' using Django 2.2.6.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/2.2/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/2.2/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.2/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = 'hui vam'
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 'whitenoise.runserver_nostatic',
41 'corsheaders',
42 'rest_framework',
43 'product',
44 'user_info',
45 'auction'
46]
47
48MIDDLEWARE = [
49 'corsheaders.middleware.CorsMiddleware',
50 'whitenoise.middleware.WhiteNoiseMiddleware',
51 'django.middleware.common.CommonMiddleware',
52 'django.middleware.security.SecurityMiddleware',
53 'django.contrib.sessions.middleware.SessionMiddleware',
54 'django.middleware.common.CommonMiddleware',
55 'django.middleware.csrf.CsrfViewMiddleware',
56 'django.contrib.auth.middleware.AuthenticationMiddleware',
57 'django.contrib.messages.middleware.MessageMiddleware',
58 'django.middleware.clickjacking.XFrameOptionsMiddleware',
59]
60
61ROOT_URLCONF = 'app.urls'
62
63TEMPLATES = [
64 {
65 'BACKEND': 'django.template.backends.django.DjangoTemplates',
66 'DIRS': [os.path.join(BASE_DIR, 'build')],
67 'APP_DIRS': True,
68 'OPTIONS': {
69 'context_processors': [
70 'django.template.context_processors.debug',
71 'django.template.context_processors.request',
72 'django.contrib.auth.context_processors.auth',
73 'django.contrib.messages.context_processors.messages',
74 ],
75 },
76 },
77]
78
79WSGI_APPLICATION = 'app.wsgi.application'
80
81
82CORS_ORIGIN_ALLOW_ALL = True
83
84# CORS_ORIGIN_WHITELIST = ['http://localhost:3001','http://localhost:3000']
85
86# Database
87# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
88
89DATABASES = {
90 'default': {
91 'ENGINE': 'django.db.backends.sqlite3',
92 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
93 }
94}
95
96
97# Password validation
98# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
99
100AUTH_PASSWORD_VALIDATORS = [
101 {
102 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
103 },
104 {
105 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
106 },
107 {
108 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
109 },
110 {
111 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
112 },
113]
114
115REST_FRAMEWORK = {
116 'DEFAULT_AUTHENTICATION_CLASSES': (
117 'rest_framework_simplejwt.authentication.JWTAuthentication',
118 # 'rest_framework.authentication.SessionAuthentication',
119 ),
120 'DEFAULT_PERMISSION_CLASSES': [
121 'rest_framework.permissions.IsAuthenticated',
122 ]
123}
124
125
126# Internationalization
127# https://docs.djangoproject.com/en/2.2/topics/i18n/
128
129LANGUAGE_CODE = 'en-us'
130
131TIME_ZONE = 'UTC'
132
133USE_I18N = True
134
135USE_L10N = True
136
137USE_TZ = True
138
139
140# Static files (CSS, JavaScript, Images)
141# https://docs.djangoproject.com/en/2.2/howto/static-files/
142
143STATIC_URL = '/static/'
144
145STATICFILES_DIRS = [
146 os.path.join(BASE_DIR, 'build/static'),
147]
148
149STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
150STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
151
152SITE_ID = 1