· 9 years ago · Aug 10, 2016, 11:33 AM
1# -*- coding: utf-8 -*- """ Django settings for mysite project.
2
3Generated by 'django-admin startproject' using Django 1.9.8.
4
5For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/
6
7For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """
8
9import os from django.core.mail import send_mail
10
11# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
12# BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
13# print "base dir path :", BASE_DIR
14# resultat du print => /home/cpoudevigne/Projets/MyMemoryBox/mysite
15
16# Quick-start development settings - unsuitable for production
17# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
18
19# SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'fywfd7s@e%36b_g@%!lt3o$t6i5g(&pfa8f9aa5#fhe@%7dzh('
20
21# SECURITY WARNING: don't run with debug turned on in production! DEBUG = True
22
23ALLOWED_HOSTS = []
24
25# Grappelli settings
26
27GRAPPELLI_ADMIN_TITLE = "MyMemoryBox.fr"
28
29# Application definition
30
31INSTALLED_APPS = [
32 'grappelli',
33 'django.contrib.admin',
34 'django.contrib.auth',
35 'django.contrib.contenttypes',
36 'django.contrib.sessions',
37 'django.contrib.messages',
38 'django.contrib.staticfiles',
39 'avatar',
40 'registration',
41 'mymemoryapp', ]
42
43MIDDLEWARE_CLASSES = [
44 'django.middleware.security.SecurityMiddleware',
45 'django.contrib.sessions.middleware.SessionMiddleware',
46 'django.middleware.common.CommonMiddleware',
47 'django.middleware.csrf.CsrfViewMiddleware',
48 'django.contrib.auth.middleware.AuthenticationMiddleware',
49 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
50 'django.contrib.messages.middleware.MessageMiddleware',
51 'django.middleware.clickjacking.XFrameOptionsMiddleware', ]
52
53ROOT_URLCONF = 'mysite.urls'
54
55TEMPLATES = [
56 {
57 'BACKEND': 'django.template.backends.django.DjangoTemplates',
58 'DIRS': [],
59 'APP_DIRS': True,
60 'OPTIONS': {
61 'context_processors': [
62 'django.template.context_processors.debug',
63 'django.template.context_processors.request',
64 'django.contrib.auth.context_processors.auth',
65 'django.contrib.messages.context_processors.messages',
66 ],
67 },
68 }, ]
69
70WSGI_APPLICATION = 'mysite.wsgi.application'
71
72# Database
73# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
74
75DATABASES = {
76 'default': {
77 'ENGINE': 'django.db.backends.mysql',
78 'NAME': 'mymemorybox',
79 'USER': 'root',
80 'PASSWORD': 'Abc123op34',
81 'HOST': 'localhost',
82 } }
83
84# Django-registration settings ACCOUNT_ACTIVATION_DAYS = 7 LOGIN_REDIRECT_URL = '/'
85
86# Password validation
87# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
88
89AUTH_PASSWORD_VALIDATORS = [
90 {
91 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
92 },
93 {
94 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
95 },
96 {
97 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
98 },
99 {
100 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
101 }, ]
102
103# Django-mail Settings
104
105EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_USE_TLS = True EMAIL_PORT = 587 EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = 'christopher.poudevigne@gmail.com' EMAIL_HOST_PASSWORD = 'Abc123op34' DEFAULT_FROM_EMAIL = 'MyMemoryBox'
106
107# Internationalization
108# https://docs.djangoproject.com/en/1.9/topics/i18n/
109
110LANGUAGE_CODE = 'en-us'
111
112TIME_ZONE = 'UTC'
113
114USE_I18N = True
115
116USE_L10N = True
117
118USE_TZ = True
119
120# Static files (CSS, JavaScript, Images)
121# https://docs.djangoproject.com/en/1.9/howto/static-files/ PROJECT_DIR = os.path.dirname(__file__) print "PROJECT_DIR :", PROJECT_DIR
122
123MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media') MEDIA_URL = '/media/' STATIC_ROOT = os.path.join(PROJECT_DIR, 'mysite', 'static') STATIC_URL
124= '/static/'
125
126STATICFILES_DIRS = (
127 # Put strings here, like "/home/html/static" or "C:/www/django/static".
128 # Always use forward slashes, even on Windows.
129 # Don't forget to use absolute paths, not relative paths.
130 os.path.join(PROJECT_DIR, 'static/'), ) print 'STATICFILES_DIRS :', STATICFILES_DIRS