1.3
[auf_recipe_django.git] / auf / recipe / django / boilerplate.py
index 661aa16..3aa64a4 100644 (file)
@@ -1,4 +1,39 @@
 # -*- encoding: utf-8 -*-
+import zc.buildout.easy_install
+
+
+env = '''
+%(relative_paths_setup)s
+import sys
+import pkg_resources
+
+eggs_path = [
+    %(path)s,
+    ]
+
+sys.path[0:0] = eggs_path
+
+# correction des namespaces virtuels
+for egg_path in eggs_path:
+    pkg_resources.fixup_namespace_packages(egg_path)
+%(initialization)s
+import %(module_name)s
+'''
+
+auf_buildout_file = zc.buildout.easy_install.script_header + env + '''\
+if __name__ == '__main__':
+    %(module_name)s.%(attrs)s(%(arguments)s)
+'''
+
+auf_script_template = {
+    'wsgi': env + """
+application = %(module_name)s.%(attrs)s(%(arguments)s)
+""",
+    'fcgi': env + """
+%(module_name)s.%(attrs)s(%(arguments)s)
+""",
+}
+
 
 ################################################################################
 # SETTINGS