[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] Template not found using upload_template
From: |
Jeff Forcier |
Subject: |
Re: [Fab-user] Template not found using upload_template |
Date: |
Mon, 11 Jan 2010 08:40:49 -0500 |
Hi Matias,
I think the confusion stems from the fact that upload_template behaves
much like your average Web framework's template loader library[1] --
template locations are specified in two parts, the template directory,
and then a (always relative *to* that template directory!) short path
to the template file itself.
So, going by the docs here:
http://docs.fabfile.org/0.9.0/api/contrib/files.html#fabric.contrib.files.upload_template
then upload_template has a 'template_dir' kwarg, which defaults to the
user's current working directory (i.e. typically the root of your
project). Thus, specifying a formatted/absolute filepath to the
'filename' argument isn't going to work too well.
Outside of this not being terribly intuitive for those not used to a
Web framework, what would have made you less confused? I wonder if the
first argument could be renamed to 'template_name' instead of
'filename', which would be a little more accurate.
Best,
Jeff
[1] This is partly so that the usage is consistent when using Jinja2
versus not using it.
2010/1/11 Matías Iturburu <address@hidden>:
> Hi list:
> Being a noob with fabric as I am I've found a rather confusing behaviour.
> Hope some of you can enlighten me .
> If I run :
>
> ...
> upload_template("conf/django-wsgi-template.txt",
> 'django.wsgi',
> context,
> use_jinja=True)
>
> It generates the template without a fuss. But if I format the filepath
> string it rises TemplateNotFound
>
> BASE_DIR = os.path.dirname(__file__)
> ...
> upload_template('%s/conf/django-wsgi-template.txt' %(BASE_DIR,),
> 'django.wsgi',
> context,
> use_jinja=True)
>
> Although the file is present and the path is correct.
> Why is fabric rejecting my file? Is this the right behavior and I'm just
> doing things wrong?
>
> Thanks in advancee
>
>
>
>
> --
> Matías Iturburu
> http://www.linkedin.com/in/miturburu
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user
>
>
--
Jeff Forcier
Unix sysadmin; Python/Ruby developer
http://bitprophet.org