It seems so obvious now! :-)
I can do ...
t = Template(open('users.template').read())
c = Context([get the users from db])
open('users.cfg','w').write(t.render(c))
Thanks for your speedy response! It seems I couldn't see the wood for
the trees
-Paul
On Feb 29, 8:24 pm, Kurtis Mullins <kurtis.mull...@gmail.com> wrote:
> Hey,
>
> I just thought I'd give you a quick reply. First, you can save the rendered
> output of a template using this:
>
> https://docs.djangoproject.com/en/1.3/ref/templates/api/#rendering-a-...
>
> Then, take that String and write over that 'users.cfg' file. For example,
>
> http://docs.python.org/tutorial/inputoutput.html
>
> Hopefully that helps a little bit. I'm not sure if I understand the problem
> right but I figured I'd give it a shot.
>
> Good luck!
> - Kurtis
>
> On Wed, Feb 29, 2012 at 4:27 PM, Paul Bunker <paulmarkbun...@gmail.com>wrote:
>
>
>
>
>
>
>
> > Hi Django Users,
>
> > I'd like to use the django template system to generate a file
> > 'users.cfg' that gets read some dispatching software. Is it possible
> > to get django to generate this file and replace the existing one?
>
> > Thanks
> > -Paul
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > 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.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
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