On Thursday 29 October 2009 09:21:26 Johan wrote: > The information you provided is very helpful and I have been wondering > about overriding templates.However, my question pertain not to > templates as in the templating system used in django but rather to the > 'template' directories used by django-admin.py when the startproject > and startapp commands are executed. At the moment these commands > merely copies some files within the django installation directory. In > the case of a new project's settings.py it is copied and then modified > by adding a new secret key and the project url string.
You can add to it by writing your own management command. With something like
this:
from django.core.management.base import LabelCommand, CommandError
from django.core.management import call_command
class = Command(LabelCommand):
def handle_label(self, project_name, **options):
# create initial project, use startapp for app.
call_command('startproject', project_name)
output = []
#do stuff to template dir settings for project
return u'\n'.join(output)
Inside the command startproject[1] you can see how SECRET_KEY value is
intially set. call_command[2] is the suggested way of accessing the other
commands within your apps. Then use this command to start your projects or
apps.
Hope This Helps
Mike
[1]
http://code.djangoproject.com/browser/django/trunk/django/core/management/commands/startproject.py
[2]
http://code.djangoproject.com/browser/django/trunk/django/core/management/__init__.py#L135
--
signature.asc
Description: This is a digitally signed message part.

