· 4 years ago · Dec 04, 2020, 03:56 PM
1"""
2Django settings for project project.
3Generated by 'django-admin startproject' using Django 3.1.1.
4For more information on this file, see
5https://docs.djangoproject.com/en/3.1/topics/settings/
6For the full list of settings and their values, see
7https://docs.djangoproject.com/en/3.1/ref/settings/
8"""
9
10from pathlib import Path
11import os
12
13# Build paths inside the project like this: BASE_DIR / 'subdir'.
14BASE_DIR = Path(__file__).resolve().parent.parent
15
16
17# Quick-start development settings - unsuitable for production
18# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
19
20# SECURITY WARNING: keep the secret key used in production secret!
21SECRET_KEY = '&6b1dfsnxov&dtk1(8vopc&x%yhwp&5bdp+14izh#+3d5kx%z!'
22
23# SECURITY WARNING: don't run with debug turned on in production!
24DEBUG = True
25
26ALLOWED_HOSTS = ['*']
27CORS_ORIGIN_ALLOW_ALL=True
28
29
30# Application definition
31
32INSTALLED_APPS = [
33 'django.contrib.admin',
34 'django.contrib.auth',
35 'django.contrib.contenttypes',
36 'django.contrib.sessions',
37 'django.contrib.messages',
38 'django.contrib.staticfiles',
39 'documents',
40 'rest_framework',
41 'corsheaders',
42 'drf_yasg'
43]
44
45MIDDLEWARE = [
46 'django.middleware.security.SecurityMiddleware',
47 'django.contrib.sessions.middleware.SessionMiddleware',
48 'corsheaders.middleware.CorsMiddleware',
49 'django.middleware.common.CommonMiddleware',
50 'django.middleware.csrf.CsrfViewMiddleware',
51 'django.contrib.auth.middleware.AuthenticationMiddleware',
52 'django.contrib.messages.middleware.MessageMiddleware',
53 'django.middleware.clickjacking.XFrameOptionsMiddleware',
54]
55
56ROOT_URLCONF = 'project.urls'
57
58TEMPLATES = [
59 {
60 'BACKEND': 'django.template.backends.django.DjangoTemplates',
61 'DIRS': [],
62 'APP_DIRS': True,
63 'OPTIONS': {
64 'context_processors': [
65 'django.template.context_processors.debug',
66 'django.template.context_processors.request',
67 'django.contrib.auth.context_processors.auth',
68 'django.contrib.messages.context_processors.messages',
69 ],
70 },
71 },
72]
73
74WSGI_APPLICATION = 'project.wsgi.application'
75
76
77# Database
78# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
79
80DATABASES = {
81 'default': {
82 'ENGINE': 'django.db.backends.sqlite3',
83 'NAME': BASE_DIR / 'db.sqlite3',
84 }
85}
86
87
88# Password validation
89# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
90
91AUTH_PASSWORD_VALIDATORS = [
92 {
93 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
94 },
95 {
96 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
97 },
98 {
99 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
100 },
101 {
102 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
103 },
104]
105
106
107# Internationalization
108# https://docs.djangoproject.com/en/3.1/topics/i18n/
109
110LANGUAGE_CODE = 'en-us'
111
112TIME_ZONE = 'UTC'
113
114USE_I18N = True
115
116USE_L10N = True
117
118USE_TZ = True
119
120
121# Static files (CSS, JavaScript, Images)
122# https://docs.djangoproject.com/en/3.1/howto/static-files/
123
124STATIC_URL = '/static/'
125STATIC_ROOT = os.path.join(BASE_DIR, 'static')
126
127CELERY_BROKER_URL = 'redis://localhost:6379'
128CELERY_RESULT_BACKEND = 'redis'
129CELERY_CACHE_BACKEND = 'redis'
130#CELERY_TASK_ALWAYS_EAGER = True
131
132REST_FRAMEWORK = {
133 'DEFAULT_RENDERER_CLASSES': (
134 'rest_framework.renderers.JSONRenderer',
135 )
136}