aae5cecb4360a665c800b1ae86cd35448d261611
1 # -*- encoding: utf-8 -*-
8 from djangorecipe
.boilerplate
import versions
9 from djangorecipe
.recipe
import Recipe
as OriginalDjangoRecipe
10 from boilerplate
import *
12 djangorecipe
.boilerplate
.versions
['1.3']['settings'] = auf_settings_template
13 djangorecipe
.boilerplate
.versions
['1.3']['urls'] = auf_urls_template
14 djangorecipe
.boilerplate
.versions
['1.3']['production_settings'] = auf_production_settings
15 djangorecipe
.boilerplate
.versions
['1.3']['development_settings'] = auf_development_settings
18 class Recipe(OriginalDjangoRecipe
):
23 location
= self
.options
['location']
24 base_dir
= self
.buildout
['buildout']['directory']
25 self
.options
['project_name'] = os
.path
.basename(base_dir
)
27 project_dir
= os
.path
.join(base_dir
, self
.options
['project'])
29 extra_paths
= self
.get_extra_paths()
30 requirements
, ws
= self
.egg
.working_set(['djangorecipe'])
34 # Create the Django management script
35 script_paths
.extend(self
.create_manage_script(extra_paths
, ws
))
37 # Create the test runner
38 script_paths
.extend(self
.create_test_runner(extra_paths
, ws
))
40 # Make the wsgi and fastcgi scripts if enabled
41 script_paths
.extend(self
.make_scripts(extra_paths
, ws
))
43 # Create default settings if we haven't got a project
44 # egg specified, and if it doesn't already exist
45 if not self
.options
.get('projectegg'):
46 if not os
.path
.exists(project_dir
):
47 self
.create_project(project_dir
)
50 'Skipping creating of project: %(project)s since '
51 'it exists' % self
.options
)
53 return script_paths
+ [location
]
55 def create_project(self
, project_dir
):
56 super(Recipe
, self
).create_project(project_dir
)
58 # fichier de configuration de base de données
59 self
.create_file(os
.path
.join(project_dir
, 'conf.py'), conf_file
, self
.options
)
60 self
.create_file(os
.path
.join(project_dir
, 'conf.py.edit'), conf_file
, self
.options
)
61 self
.create_file(os
.path
.join(project_dir
, 'dashboard.py'), dashboard_file
, self
.options
)
63 def create_manage_script(self
, extra_paths
, ws
):
64 project
= self
.options
.get('projectegg', self
.options
['project'])
65 return zc
.buildout
.easy_install
.scripts(
66 [(self
.options
.get('control-script', self
.name
),
67 'auf.recipe.django.manage', 'main')],
68 ws
, self
.options
['executable'], self
.options
['bin-directory'],
69 extra_paths
=extra_paths
,
70 arguments
="'%s.%s'" % (project
,
71 self
.options
['settings']))