· 5 years ago · Mar 04, 2020, 09:24 AM
1"""
2Django settings for mysite project.
3Generated by 'django-admin startproject' using Django 1.10.2.
4For more information on this file, see
5https://docs.djangoproject.com/en/1.10/topics/settings/
6For the full list of settings and their values, see
7https://docs.djangoproject.com/en/1.10/ref/settings/
8"""
9
10from decouple import config, Csv
11import dj_database_url
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__)))
17PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
18
19
20# Quick-start development settings - unsuitable for production
21# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
22
23# SECURITY WARNING: keep the secret key used in production secret!
24SECRET_KEY = '_01mmd_zcyqa60)w904zioyw3(vkbzbq#s7r&g^brmaeruqx7k'
25
26# SECURITY WARNING: don't run with debug turned on in production!
27DEBUG = True
28
29ALLOWED_HOSTS = ['local.django.co.uk']
30
31
32# Application definition
33
34INSTALLED_APPS = [
35 'django.contrib.admin',
36 'django.contrib.auth',
37 'django.contrib.contenttypes',
38 'django.contrib.sessions',
39 'django.contrib.messages',
40 'django.contrib.staticfiles',
41 'mysite.core',
42]
43
44MIDDLEWARE_CLASSES = [
45 'django.middleware.security.SecurityMiddleware',
46 'django.contrib.sessions.middleware.SessionMiddleware',
47 'django.middleware.common.CommonMiddleware',
48 'django.middleware.csrf.CsrfViewMiddleware',
49 'django.contrib.auth.middleware.AuthenticationMiddleware',
50 'django.contrib.messages.middleware.MessageMiddleware',
51 'django.middleware.clickjacking.XFrameOptionsMiddleware',
52]
53
54ROOT_URLCONF = 'mysite.urls'
55
56TEMPLATES = [
57 {
58 'BACKEND': 'django.template.backends.django.DjangoTemplates',
59 'DIRS': [os.path.join(BASE_DIR, 'mysite/templates')],
60 'APP_DIRS': True,
61 'OPTIONS': {
62 'context_processors': [
63 'django.template.context_processors.debug',
64 'django.template.context_processors.request',
65 'django.contrib.auth.context_processors.auth',
66 'django.contrib.messages.context_processors.messages',
67 ],
68 },
69 },
70]
71
72WSGI_APPLICATION = 'mysite.wsgi.application'
73
74
75# Database
76# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
77
78DATABASES = {
79 'default': {
80 'ENGINE': 'django.db.backends.sqlite3',
81 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
82 }
83}
84
85AUTHENTICATION_BACKENDS = (
86 'django.contrib.auth.backends.ModelBackend',
87)
88
89
90# Internationalization
91# https://docs.djangoproject.com/en/1.10/topics/i18n/
92
93LANGUAGE_CODE = 'en-us'
94
95TIME_ZONE = 'UTC'
96
97USE_I18N = True
98
99USE_L10N = True
100
101USE_TZ = True
102
103
104# Static files (CSS, JavaScript, Images)
105# https://docs.djangoproject.com/en/1.10/howto/static-files/
106
107STATIC_URL = '/static/'
108STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
109STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
110
111STATICFILES_DIRS = (
112 os.path.join(PROJECT_ROOT, 'static'),
113)
114
115LOGIN_URL = 'login'
116LOGOUT_URL = 'logout'
117LOGIN_REDIRECT_URL = 'home'