2.3
[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
19d7fb26
OL
5env = '''
6%(relative_paths_setup)s
7import sys
19d7fb26
OL
8
9eggs_path = [
10 %(path)s,
11 ]
12
13sys.path[0:0] = eggs_path
14
c7a67069
OL
15import pkg_resources
16
19d7fb26
OL
17# correction des namespaces virtuels
18for egg_path in eggs_path:
19 pkg_resources.fixup_namespace_packages(egg_path)
20%(initialization)s
21import %(module_name)s
22'''
23
24auf_buildout_file = zc.buildout.easy_install.script_header + env + '''\
25if __name__ == '__main__':
26 %(module_name)s.%(attrs)s(%(arguments)s)
27'''
28
ca00766f
OL
29sentry = """try:
30 from raven.contrib.django.middleware.wsgi import Sentry
31 application = Sentry(application)
32except:
33 pass
34"""
35
19d7fb26
OL
36auf_script_template = {
37 'wsgi': env + """
38application = %(module_name)s.%(attrs)s(%(arguments)s)
ca00766f 39""" + sentry,
19d7fb26
OL
40 'fcgi': env + """
41%(module_name)s.%(attrs)s(%(arguments)s)
ca00766f 42""" +sentry,
19d7fb26 43}