· 5 years ago · Mar 27, 2020, 05:32 PM
1"""
2Django settings for watchlist_backend project.
3
4Generated by 'django-admin startproject' using Django 3.0.3.
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 = '77fsla9%%qs=s0zjkt+8ud!1^rhw-_p=aj%uijgk4zssa+1qjz'
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 'corsheaders',
41 'knox',
42 'accounts.apps.AccountsConfig',
43 'mediaItem.apps.MediaitemConfig'
44 #trengs 'rest_framework',?
45]
46
47REST_FRAMEWORK = {
48 # 'DEFAULT_PERMISSION_CLASSES': [ # remove
49 # 'rest_framework.permissions.AllowAny'
50 # ],
51 'DEFAULT_AUTHENTICATION_CLASSES': (
52 'knox.auth.TokenAuthentication',
53 ),
54 'DATETIME_FORMAT': "%d/%m/%Y %H:%M:%S",
55}
56
57MIDDLEWARE = [
58 'corsheaders.middleware.CorsMiddleware',
59 'django.middleware.security.SecurityMiddleware',
60 'django.contrib.sessions.middleware.SessionMiddleware',
61 'django.middleware.common.CommonMiddleware',
62 'django.middleware.csrf.CsrfViewMiddleware',
63 'django.contrib.auth.middleware.AuthenticationMiddleware',
64 'django.contrib.messages.middleware.MessageMiddleware',
65 'django.middleware.clickjacking.XFrameOptionsMiddleware',
66]
67
68CORS_ORIGIN_ALLOW_ALL = True
69
70ROOT_URLCONF = 'watchlist_backend.urls'
71
72TEMPLATES = [
73 {
74 'BACKEND': 'django.template.backends.django.DjangoTemplates',
75 'DIRS': [],
76 'APP_DIRS': True,
77 'OPTIONS': {
78 'context_processors': [
79 'django.template.context_processors.debug',
80 'django.template.context_processors.request',
81 'django.contrib.auth.context_processors.auth',
82 'django.contrib.messages.context_processors.messages',
83 ],
84 },
85 },
86]
87
88WSGI_APPLICATION = 'watchlist_backend.wsgi.application'
89
90
91# Database
92# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
93
94DATABASES = {
95 'default': {
96 'ENGINE': 'django.db.backends.sqlite3',
97 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
98 }
99}
100
101
102# Password validation
103# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
104
105AUTH_PASSWORD_VALIDATORS = [
106 {
107 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
108 },
109 {
110 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
111 },
112 {
113 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
114 },
115 {
116 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
117 },
118]
119
120
121# Internationalization
122# https://docs.djangoproject.com/en/3.0/topics/i18n/
123
124LANGUAGE_CODE = 'en-us'
125
126TIME_ZONE = 'UTC'
127
128USE_I18N = True
129
130USE_L10N = True
131
132USE_TZ = True
133
134
135# Static files (CSS, JavaScript, Images)
136# https://docs.djangoproject.com/en/3.0/howto/static-files/
137
138STATIC_URL = '/static/'