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