startproject/startapp template context

100 views
Skip to first unread message

Sam Simmons

unread,
Apr 30, 2012, 11:39:56 PM4/30/12
to django...@googlegroups.com
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!

Sam Simmons

unread,
May 1, 2012, 8:18:34 AM5/1/12
to django...@googlegroups.com
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...

Sam Simmons

unread,
May 1, 2012, 9:50:42 AM5/1/12
to django...@googlegroups.com
This has turned into a topic for django developers.
Reply all
Reply to author
Forward
0 new messages