[#2465] Workaround pour le ticket Django #14087
[auf_recipe_django.git] / auf / recipe / django / boilerplate.py
CommitLineData
4be9d9da
OL
1# -*- encoding: utf-8 -*-
2
3################################################################################
4# SETTINGS
5################################################################################
6
7conf_file = '''# -*- encoding: utf-8 -*
8
9DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
10DATABASE_NAME = ''
11DATABASE_USER = '' # Not used with sqlite3.
12DATABASE_PASSWORD = '' # Not used with sqlite3.
13DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
14DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
15'''
16
17dashboard_file ='''# -*- encoding: utf-8 -*
18
19"""
20This file was generated with the customdashboard management command, it
21contains the two classes for the main dashboard and app index dashboard.
22You can customize these classes as you want.
23
24To activate your index dashboard add the following to your settings.py::
25 ADMIN_TOOLS_INDEX_DASHBOARD = 'SIGMA.dashboard.CustomIndexDashboard'
26
27And to activate the app index dashboard::
28 ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'SIGMA.dashboard.CustomAppIndexDashboard'
29"""
30
31from django.utils.translation import ugettext_lazy as _
32from django.core.urlresolvers import reverse
33
34from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard
35from admin_tools.utils import get_admin_site_name
36
37
38class CustomIndexDashboard(Dashboard):
39 """
40 Custom index dashboard for SIGMA.
41 """
42 def init_with_context(self, context):
43 site_name = get_admin_site_name(context)
44
45 # append an app list module for "Applications"
46 self.children.append(modules.AppList(
47 _('Applications'),
48 exclude=('django.contrib.*',),
49 ))
50
51 # append an app list module for "Administration"
52 self.children.append(modules.AppList(
53 _('Administration'),
54 models=('django.contrib.*',),
55 ))
56
57 # append a recent actions module
58 self.children.append(modules.RecentActions(_('Recent Actions'), 5))
59'''
60
61
62auf_urls_template = '''# -*- encoding: utf-8 -*
63from django.conf.urls.defaults import patterns, include, handler500, handler404, url
64from django.conf import settings
65from django.contrib import admin
66
67admin.autodiscover()
68
69handler404
70handler500 # Pyflakes
71
72urlpatterns = patterns(
73 '',
74 ######## page d'accueil de demo ######
75 (r'^$', 'auf.django.skin.views.demo'),
76 ######################################
77 url(r'^admin_tools/', include('admin_tools.urls')),
78 (r'^admin/', include(admin.site.urls)),
79 (r'^connexion/$', 'django.contrib.auth.views.login'),
80 (r'^deconnexion/$', 'django.contrib.auth.views.logout'),
81
82)
83
84if settings.DEBUG:
85 urlpatterns += patterns('',
86 (r'^media/(?P<path>.*)$', 'django.views.static.serve',
87 {'document_root': settings.MEDIA_ROOT}),
88 )
89'''
90
91auf_settings_template = '''# -*- encoding: utf-8 -*-
92
93import os
94import socket
95from conf import *
96
97# Rapports d'erreurs
98EMAIL_SUBJECT_PREFIX = '[%(project_name)s - %%s] ' %% socket.gethostname()
99ADMINS = (
100 ('Équipe ARI-SI', 'developpeurs@ca.auf.org'),
101)
102
103MANAGERS = ADMINS
104
105TIME_ZONE = 'Canada/Montreal'
106
107LANGUAGE_CODE = 'fr-ca'
108
109# Absolute path to the directory that holds media.
110# Example: "/home/media/media.lawrence.com/"
111MEDIA_ROOT = %(media_root)s
112
113# URL that handles the media served from MEDIA_ROOT. Make sure to use a
114# trailing slash if there is a path component (optional in other cases).
115# Examples: "http://media.lawrence.com", "http://example.com/media/"
116MEDIA_URL = '/media/'
117
118# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
119# trailing slash.
120# Examples: "http://foo.com/media/", "/media/".
121ADMIN_MEDIA_PREFIX = '/media/django/'
122
123# Don't share this with anybody.
124SECRET_KEY = '%(secret)s'
125
126MIDDLEWARE_CLASSES = (
127 'django.middleware.common.CommonMiddleware',
128 'django.contrib.sessions.middleware.SessionMiddleware',
129 'django.contrib.auth.middleware.AuthenticationMiddleware',
130 'django.middleware.doc.XViewMiddleware',
131)
132
133ROOT_URLCONF = '%(urlconf)s'
134
135
136INSTALLED_APPS = (
137 'auf.django.skin',
138 'admin_tools',
139 'admin_tools.theming',
140 'admin_tools.menu',
141 'admin_tools.dashboard',
142 'django.contrib.auth',
143 'django.contrib.contenttypes',
144 'django.contrib.sessions',
145 'django.contrib.admin',
146 'south',
147)
148
149TEMPLATE_CONTEXT_PROCESSORS = (
150 'django.core.context_processors.auth',
151 'django.core.context_processors.debug',
152 'django.core.context_processors.i18n',
153 'django.core.context_processors.media',
154 'django.contrib.messages.context_processors.messages',
155 'django.core.context_processors.request',
156 'auf.django.skin.context_processors.auf',
157)
158
159
160TEMPLATE_LOADERS = (
161 'django.template.loaders.filesystem.load_template_source',
162 'django.template.loaders.app_directories.load_template_source',
163)
164
165TEMPLATE_DIRS = (
166 os.path.join(os.path.dirname(__file__), "templates"),
167)
168
169SOUTH_TESTS_MIGRATE = False
170
171ADMIN_TOOLS_INDEX_DASHBOARD = 'project.dashboard.CustomIndexDashboard'
172
173'''
174
175################################################################################
176# DEVELOPPEMENT
177################################################################################
178auf_development_settings = '''# -*- encoding: utf-8 -*-
179
180from %(project)s.settings import *
181DEBUG=True
182TEMPLATE_DEBUG=DEBUG
183
184# Décommentez ces lignes pour activer la debugtoolbar
185#INTERNAL_IPS = ('127.0.0.1',)
186#INSTALLED_APPS += ('debug_toolbar',)
187#MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
188
189AUTH_PASSWORD_REQUIRED = False
190'''
191
192################################################################################
193# PRODUCTION
194################################################################################
195auf_production_settings = ''' # -*- encoding: utf-8 -*-
196
197# En production, rediriger la sortie terminal on disponible en WSGI
198# vers la sortie fichier errorlog.
199import sys
200sys.stdout = sys.stderr
201
202from %(project)s.settings import *
203'''