· 6 years ago · Nov 04, 2019, 06:12 PM
1"""
2Django settings for AgotProApi 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 = 'w6@7aq7rqu5!afn(=3!io!g$8-9&h63yd*lggxgduu@zpur!or'
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 #My Apps
35 'Learning',
36 'Account',
37 'Extra',
38
39 #Django Apps
40 'corsheaders',
41 'django.contrib.admin',
42 'django.contrib.auth',
43 'django.contrib.contenttypes',
44 'django.contrib.sessions',
45 'django.contrib.messages',
46 'django.contrib.staticfiles',
47 'rest_framework',
48 'rest_framework.authtoken',
49]
50
51MIDDLEWARE = [
52 'django.middleware.security.SecurityMiddleware',
53 'django.contrib.sessions.middleware.SessionMiddleware',
54 'corsheaders.middleware.CorsMiddleware',
55 'django.middleware.common.CommonMiddleware',
56 'django.middleware.csrf.CsrfViewMiddleware',
57 'django.contrib.auth.middleware.AuthenticationMiddleware',
58 'django.contrib.messages.middleware.MessageMiddleware',
59 'django.middleware.clickjacking.XFrameOptionsMiddleware',
60
61]
62
63CORS_ORIGIN_ALLOW_ALL = True
64
65ROOT_URLCONF = 'AgotProApi.urls'
66
67TEMPLATES = [
68 {
69 'BACKEND': 'django.template.backends.django.DjangoTemplates',
70 'DIRS': [],
71 'APP_DIRS': True,
72 'OPTIONS': {
73 'context_processors': [
74 'django.template.context_processors.debug',
75 'django.template.context_processors.request',
76 'django.contrib.auth.context_processors.auth',
77 'django.contrib.messages.context_processors.messages',
78 ],
79 },
80 },
81]
82
83REST_FRAMEWORK = {
84 'DEFAULT_AUTHENTICATION_CLASSES':[
85 'rest_framework.authentication.TokenAuthentication',
86 ],
87 'DEFAULT_PERMISSION_CLASSES':[
88 'rest_framework.permissions.IsAuthenticated',
89 ],
90}
91
92
93AUTH_USER_MODEL = 'Account.Account' #Tells Django where our custom user is
94
95WSGI_APPLICATION = 'AgotProApi.wsgi.application'
96
97
98# Database
99# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
100
101DATABASES = {
102 'default': {
103 'ENGINE': 'django.db.backends.sqlite3',
104 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
105 }
106}
107
108
109# Password validation
110# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
111
112AUTH_PASSWORD_VALIDATORS = [
113 {
114 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
115 },
116 {
117 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
118 },
119 {
120 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
121 },
122 {
123 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
124 },
125]
126
127
128# Internationalization
129# https://docs.djangoproject.com/en/2.2/topics/i18n/
130
131LANGUAGE_CODE = 'en-us'
132
133TIME_ZONE = 'UTC'
134
135USE_I18N = True
136
137USE_L10N = True
138
139USE_TZ = True
140
141
142# Static files (CSS, JavaScript, Images)
143# https://docs.djangoproject.com/en/2.2/howto/static-files/
144
145STATIC_URL = '/static/'