comparison settings/settings.py @ 149:b1c16cd53b62

update django to version 1.11, refactor project structure, better PEP-8 compliance
author souliane <souliane@mailoo.org>
date Tue, 17 Oct 2017 04:11:21 +0200
parents
children 87382593e514
comparison
equal deleted inserted replaced
148:75a95a1dfeb6 149:b1c16cd53b62
1 # -*- coding: utf-8 -*-
2 """
3 Django settings for sat_website project.
4
5 Generated by 'django-admin startproject' using Django 1.11.6.
6
7 For more information on this file, see
8 https://docs.djangoproject.com/en/1.11/topics/settings/
9
10 For the full list of settings and their values, see
11 https://docs.djangoproject.com/en/1.11/ref/settings/
12 """
13
14
15 import os
16 PROJECT_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/1.11/howto/deployment/checklist/
21
22 # SECURITY WARNING: keep the secret key used in production secret!
23 SECRET_KEY = '{{ secret_key }}'
24
25 # SECURITY WARNING: don't run with debug turned on in production!
26 DEBUG = True
27
28 ALLOWED_HOSTS = []
29
30
31 # Application definition
32
33 INSTALLED_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 'markdown_deux',
41 'sat_website',
42 ]
43
44 MIDDLEWARE = [
45 'django.middleware.security.SecurityMiddleware',
46 'django.contrib.sessions.middleware.SessionMiddleware',
47 'django.middleware.locale.LocaleMiddleware', # after SessionMiddleWare AND before CommonMiddleWare
48 'django.middleware.common.CommonMiddleware',
49 'django.middleware.csrf.CsrfViewMiddleware',
50 'django.contrib.auth.middleware.AuthenticationMiddleware',
51 'django.contrib.messages.middleware.MessageMiddleware',
52 'django.middleware.clickjacking.XFrameOptionsMiddleware',
53 ]
54
55 ROOT_URLCONF = 'sat_website.urls'
56
57 TEMPLATES = [
58 {
59 'BACKEND': 'django.template.backends.django.DjangoTemplates',
60 'DIRS': ["templates"],
61 'APP_DIRS': True,
62 'OPTIONS': {
63 'context_processors': [
64 'django.template.context_processors.debug',
65 'django.template.context_processors.request',
66 'django.contrib.auth.context_processors.auth',
67 'django.contrib.messages.context_processors.messages',
68 ],
69 },
70 },
71 ]
72
73 WSGI_APPLICATION = 'sat_website.wsgi.application'
74
75
76 # Database
77 # https://docs.djangoproject.com/en/1.11/ref/settings/#databases
78
79 DATABASES = {
80 'default': {
81 'ENGINE': 'django.db.backends.sqlite3',
82 'NAME': os.path.join(PROJECT_DIR, 'db.sqlite3'),
83 }
84 }
85
86
87
88 # Internationalization
89 # https://docs.djangoproject.com/en/1.11/topics/i18n/
90
91 LANGUAGE_CODE = 'en-us'
92
93 TIME_ZONE = 'Europe/Paris'
94
95 USE_I18N = True
96
97 USE_L10N = True
98
99 USE_TZ = True
100
101 LOCALE_PATHS = ("locale",)
102
103
104 # Static files (CSS, JavaScript, Images)
105 # https://docs.djangoproject.com/en/1.11/howto/static-files/
106
107 STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
108
109 STATIC_URL = '/static/'
110
111
112 # Email settings
113
114 if DEBUG:
115 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
116
117 DEFAULT_FROM_EMAIL = u'contact@salut-a-toi.org'
118 ADMINS = [("Salut à Toi", 'contact@salut-a-toi.org')]