Tuesday, May 1, 2012

Re: startproject/startapp template context

Checked the src and it's the case that the 'any options' means the ones available to the command. I could see an additional context option being useful. I'm thinking a good way to go about this would be passing a path to a config file that can be consumed by ConfigParser:

django-admin.py startproject --template=/path/to/boilerplate --template-context=options.conf myproject

opions.conf:
[options]
compass
coffee
js_dir=javascripts
css_dir=sass

Only issue is ConfigParser expects a section header which isn't necessary here...

On Monday, April 30, 2012 10:39:56 PM UTC-5, Sam Simmons wrote:
I was pretty excited to see the template option for startapp/startproject. Especially when I read your context can be any option passed to the command and it clicked that the files are rendered using django's templating system. This could make for a really nice configurable boilerplate. But, after playing with it it looks like by any option they just meant the options available to the commands (django-admin.py help startapp/project).

If that's the case, that's quite a bubble burst. Is there any way to pass in arbitrary context to the template? e.g.

django-admin.py startproject --template=/path/to/boilerplate --compass=true --coffee=true myproject

Or maybe a standard way to define a python dictionary and pass it in as the context:

django-admin.py startproject --template=/path/to/boilerplate --template-context=config.py myproject

Thanks!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/tpM8yE3XMTEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment