Ajouté SECRET_KEY à conf.py
[auf_recipe_django.git] / auf / recipe / django / boilerplate.py
CommitLineData
4be9d9da 1# -*- encoding: utf-8 -*-
dd501324 2
19d7fb26
OL
3import zc.buildout.easy_install
4
5
6env = '''
7%(relative_paths_setup)s
8import sys
19d7fb26
OL
9
10eggs_path = [
11 %(path)s,
12 ]
13
14sys.path[0:0] = eggs_path
15
c7a67069
OL
16import pkg_resources
17
19d7fb26
OL
18# correction des namespaces virtuels
19for egg_path in eggs_path:
20 pkg_resources.fixup_namespace_packages(egg_path)
21%(initialization)s
22import %(module_name)s
23'''
24
25auf_buildout_file = zc.buildout.easy_install.script_header + env + '''\
26if __name__ == '__main__':
27 %(module_name)s.%(attrs)s(%(arguments)s)
28'''
29
30auf_script_template = {
31 'wsgi': env + """
32application = %(module_name)s.%(attrs)s(%(arguments)s)
33""",
34 'fcgi': env + """
35%(module_name)s.%(attrs)s(%(arguments)s)
36""",
37}
38
4be9d9da
OL
39
40################################################################################
41# SETTINGS
42################################################################################
43
44conf_file = '''# -*- encoding: utf-8 -*
45
ac55c31f
EMS
46SECRET_KEY = ''
47
05129f35
OL
48DATABASES = {
49 'default': {
50 #'ENGINE': 'django.db.backends.mysql',
51 'ENGINE': 'django.db.backends.sqlite3',
52 'NAME': 'db.sqlite',
53 'USER': '',
54 'PASSWORD': '',
ea85f9ba
EMS
55 'HOST': '',
56 'PORT': '',
05129f35
OL
57 }
58}
4be9d9da
OL
59'''
60
61dashboard_file ='''# -*- encoding: utf-8 -*
62
4be9d9da
OL
63from django.utils.translation import ugettext_lazy as _
64from django.core.urlresolvers import reverse
65
66from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard
67from admin_tools.utils import get_admin_site_name
68
69
70class CustomIndexDashboard(Dashboard):
71 """
05129f35 72 Custom index dashboard
4be9d9da
OL
73 """
74 def init_with_context(self, context):
75 site_name = get_admin_site_name(context)
76
77 # append an app list module for "Applications"
78 self.children.append(modules.AppList(
79 _('Applications'),
80 exclude=('django.contrib.*',),
81 ))
82
83 # append an app list module for "Administration"
84 self.children.append(modules.AppList(
85 _('Administration'),
86 models=('django.contrib.*',),
87 ))
88
89 # append a recent actions module
90 self.children.append(modules.RecentActions(_('Recent Actions'), 5))
91'''
92
93
94auf_urls_template = '''# -*- encoding: utf-8 -*
95from django.conf.urls.defaults import patterns, include, handler500, handler404, url
96from django.conf import settings
97from django.contrib import admin
98
99admin.autodiscover()
100
101handler404
102handler500 # Pyflakes
103
104urlpatterns = patterns(
105 '',
106 ######## page d'accueil de demo ######
107 (r'^$', 'auf.django.skin.views.demo'),
108 ######################################
109 url(r'^admin_tools/', include('admin_tools.urls')),
110 (r'^admin/', include(admin.site.urls)),
111 (r'^connexion/$', 'django.contrib.auth.views.login'),
112 (r'^deconnexion/$', 'django.contrib.auth.views.logout'),
113
114)
115
116if settings.DEBUG:
117 urlpatterns += patterns('',
118 (r'^media/(?P<path>.*)$', 'django.views.static.serve',
119 {'document_root': settings.MEDIA_ROOT}),
120 )
121'''
122
123auf_settings_template = '''# -*- encoding: utf-8 -*-
124
125import os
126import socket
ea85f9ba
EMS
127from django.conf.global_settings import \\
128 TEMPLATE_CONTEXT_PROCESSORS as DEFAULT_TEMPLATE_CONTEXT_PROCESSORS
4be9d9da
OL
129
130# Rapports d'erreurs
4edf55b7 131SERVER_EMAIL = 'ne-pas-repondre@auf.org'
4be9d9da
OL
132EMAIL_SUBJECT_PREFIX = '[%(project_name)s - %%s] ' %% socket.gethostname()
133ADMINS = (
134 ('Équipe ARI-SI', 'developpeurs@ca.auf.org'),
135)
136
137MANAGERS = ADMINS
138
05129f35 139TIME_ZONE = 'America/Montreal'
4be9d9da
OL
140
141LANGUAGE_CODE = 'fr-ca'
142
75eeae4d 143PROJECT_ROOT = os.path.dirname(__file__)
8c098998 144SITE_ROOT = os.path.dirname(PROJECT_ROOT)
75eeae4d
OL
145
146MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
4be9d9da
OL
147MEDIA_URL = '/media/'
148
8c098998 149STATIC_ROOT = os.path.join(SITE_ROOT, 'sitestatic')
05129f35 150STATIC_URL = '/static/'
4be9d9da 151
4be9d9da
OL
152ROOT_URLCONF = '%(urlconf)s'
153
4be9d9da
OL
154INSTALLED_APPS = (
155 'auf.django.skin',
156 'admin_tools',
157 'admin_tools.theming',
158 'admin_tools.menu',
159 'admin_tools.dashboard',
160 'django.contrib.auth',
161 'django.contrib.contenttypes',
162 'django.contrib.sessions',
163 'django.contrib.admin',
05129f35 164 'django.contrib.staticfiles',
4be9d9da
OL
165 'south',
166)
167
05129f35
OL
168TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_TEMPLATE_CONTEXT_PROCESSORS + (
169 'django.core.context_processors.static',
4be9d9da
OL
170 'django.core.context_processors.request',
171 'auf.django.skin.context_processors.auf',
172)
173
4be9d9da
OL
174TEMPLATE_DIRS = (
175 os.path.join(os.path.dirname(__file__), "templates"),
176)
177
178SOUTH_TESTS_MIGRATE = False
179
180ADMIN_TOOLS_INDEX_DASHBOARD = 'project.dashboard.CustomIndexDashboard'
181
05129f35 182from conf import *
4be9d9da
OL
183'''
184
185################################################################################
186# DEVELOPPEMENT
187################################################################################
188auf_development_settings = '''# -*- encoding: utf-8 -*-
189
190from %(project)s.settings import *
191DEBUG=True
192TEMPLATE_DEBUG=DEBUG
193
194# Décommentez ces lignes pour activer la debugtoolbar
195#INTERNAL_IPS = ('127.0.0.1',)
196#INSTALLED_APPS += ('debug_toolbar',)
197#MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
198
199AUTH_PASSWORD_REQUIRED = False
200'''
201
202################################################################################
203# PRODUCTION
204################################################################################
205auf_production_settings = ''' # -*- encoding: utf-8 -*-
206
207# En production, rediriger la sortie terminal on disponible en WSGI
208# vers la sortie fichier errorlog.
209import sys
210sys.stdout = sys.stderr
211
212from %(project)s.settings import *
213'''