· 5 years ago · Apr 08, 2020, 10:52 PM
1"""
2Django settings for rene project.
3
4Generated by 'django-admin startproject' using Django 3.0.5.
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 = "eoxm)9x(+c(mt+w(ny+(@e&$rkt*%l-_=##g1)-5pa2xn23oky"
24
25# SECURITY WARNING: don't run with debug turned on in production!
26DEBUG = True
27
28ALLOWED_HOSTS = ['*']
29
30# CORS
31# Access_Control_Allow_Origin = ["*"]
32CORS_ORIGIN_ALLOW_ALL = True
33# CORS_ALLOW_CREDENTIALS = False
34# CORS_ORIGIN_WHITELIST = ['http://localhost:4200/',
35# 'https://simonnaish.github.io/SurfMaterialManagment/'
36# 'https://github.io',
37# 'https://github.com',]
38# CORS_ALLOW_METHODS = [
39# 'DELETE',
40# 'GET',
41# 'OPTIONS',
42# 'PATCH',
43# 'POST',
44# 'PUT',
45# ]
46# CORS_ALLOW_HEADERS = [
47# 'accept',
48# 'accept-encoding',
49# 'authorization',
50# 'content-type',
51# 'dnt',
52# 'origin',
53# 'user-agent',
54# 'x-csrftoken',
55# 'x-requested-with',
56# ]
57
58
59
60# Application definition
61
62INSTALLED_APPS = [
63 # 'pipeline',
64 "corsheaders",
65 "django.contrib.admin",
66 "django.contrib.auth",
67 "django.contrib.contenttypes",
68 "django.contrib.sessions",
69 "django.contrib.messages",
70 "django.contrib.staticfiles",
71 "rest_framework",
72 "rene",
73 # "rene.ApiRene.SerialsParsers",
74]
75
76MIDDLEWARE = [
77 "corsheaders.middleware.CorsMiddleware",
78 'django.middleware.common.BrokenLinkEmailsMiddleware',
79 "django.middleware.common.CommonMiddleware",
80 "django.middleware.security.SecurityMiddleware",
81 "django.contrib.sessions.middleware.SessionMiddleware",
82 "django.middleware.common.CommonMiddleware",
83 "django.middleware.csrf.CsrfViewMiddleware",
84 "django.contrib.auth.middleware.AuthenticationMiddleware",
85 "django.contrib.messages.middleware.MessageMiddleware",
86 "django.middleware.clickjacking.XFrameOptionsMiddleware",
87]
88
89ROOT_URLCONF = "rene.urls"
90
91TEMPLATES = [
92 {
93 "BACKEND": "django.template.backends.django.DjangoTemplates",
94 "DIRS": [],
95 "APP_DIRS": True,
96 "OPTIONS": {
97 "context_processors": [
98 "django.template.context_processors.debug",
99 "django.template.context_processors.request",
100 "django.contrib.auth.context_processors.auth",
101 "django.contrib.messages.context_processors.messages",
102 ],
103 },
104 },
105]
106
107WSGI_APPLICATION = "rene.wsgi.application"
108
109
110# Database
111# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
112
113DATABASES = {
114 "default": {
115 "ENGINE": "django.db.backends.sqlite3",
116 "NAME": os.path.join(BASE_DIR, "db.sqlite3"),
117 }
118}
119
120
121# Password validation
122# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
123
124AUTH_PASSWORD_VALIDATORS = [
125 {
126 "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
127 },
128 {"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",},
129 {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",},
130 {"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",},
131]
132
133
134# Internationalization
135# https://docs.djangoproject.com/en/3.0/topics/i18n/
136
137LANGUAGE_CODE = "en-us"
138
139TIME_ZONE = "UTC"
140
141USE_I18N = True
142
143USE_L10N = True
144
145USE_TZ = True
146
147
148# Static files (CSS, JavaScript, Images)
149# https://docs.djangoproject.com/en/3.0/howto/static-files/
150
151STATIC_URL = "/static/"
152
153REST_FRAMEWORK = {
154 "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination",
155 "PAGE_SIZE": 1000,
156}