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