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