2.1
[auf_recipe_django.git] / auf / recipe / django / boilerplate.py
1 # -*- encoding: utf-8 -*-
2
3 import zc.buildout.easy_install
4
5 env = '''
6 %(relative_paths_setup)s
7 import sys
8
9 eggs_path = [
10 %(path)s,
11 ]
12
13 sys.path[0:0] = eggs_path
14
15 import pkg_resources
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 sentry = """try:
30 from raven.contrib.django.middleware.wsgi import Sentry
31 application = Sentry(application)
32 except:
33 pass
34 """
35
36 auf_script_template = {
37 'wsgi': env + """
38 application = %(module_name)s.%(attrs)s(%(arguments)s)
39 """ + sentry,
40 'fcgi': env + """
41 %(module_name)s.%(attrs)s(%(arguments)s)
42 """ +sentry,
43 }