librelist archives

« back to archive

Static URL path

Static URL path

From:
Joe Esposito
Date:
2011-11-24 @ 05:30
What's the general consensus for setting static_url_path to an empty string?

Or rather, what do you do for 'robots.txt', 'favicon.ico', and any other
files expected to be at the root of the site?

Re: [flask] Static URL path

From:
Armin Ronacher
Date:
2011-11-24 @ 07:05
Hi,

On 11/24/11 6:30 AM, Joe Esposito wrote:
> What's the general consensus for setting static_url_path to an empty string?
Works obviously, the question is if it works the same way on your
webserver of choice.  Apache2 can be configured to try to serve files
from a folder first and if that fails to fall back to the application.
That does not have to work for all server configs.

> Or rather, what do you do for 'robots.txt', 'favicon.ico', and any other
> files expected to be at the root of the site?
I do not need them during development and just add a separate rule in
the server config for them.  favicon.ico I do not use since I can just
define any file with the appropriate <link> tag.  Browsers stopped
showing favicons for images anyways so not much is lost.


Regards,
Armin

Re: [flask] Static URL path

From:
Joe Esposito
Date:
2011-11-25 @ 20:39
Thanks, that makes sense. I'm using Epio (and really enjoy it, btw) so the
way you'd add it there is in their config file.

Also I noticed in development that Chrome was looking for '/favicon.ico',
that's why I was wondering about that one. Flask was 404'ing it but Chrome *
did* display the right favicon from the <link> tag. So yeah, it's a
non-issue.

On Thu, Nov 24, 2011 at 2:05 AM, Armin Ronacher <armin.ronacher@active-4.com
> wrote:

> Hi,
>
> On 11/24/11 6:30 AM, Joe Esposito wrote:
> > What's the general consensus for setting static_url_path to an empty
> string?
> Works obviously, the question is if it works the same way on your
> webserver of choice.  Apache2 can be configured to try to serve files
> from a folder first and if that fails to fall back to the application.
> That does not have to work for all server configs.
>
> > Or rather, what do you do for 'robots.txt', 'favicon.ico', and any other
> > files expected to be at the root of the site?
> I do not need them during development and just add a separate rule in
> the server config for them.  favicon.ico I do not use since I can just
> define any file with the appropriate <link> tag.  Browsers stopped
> showing favicons for images anyways so not much is lost.
>
>
> Regards,
> Armin
>
>

回复: Static URL path

From:
linnchord
Date:
2011-11-24 @ 06:47
I make it with nginx config. like:

location ~* \.(txt|ico)$ {
    alias /var/www/website_root/;
}



-------------------------------
linnchord@gmail.com


在 2011年11月24日星期四,下午1:30,Joe Esposito 写道:

> What's the general consensus for setting static_url_path to an empty string?
>  
> Or rather, what do you do for 'robots.txt', 'favicon.ico', and any other
files expected to be at the root of the site?  
>  

Re: [flask] Static URL path

From:
Adam Patterson
Date:
2011-11-24 @ 06:24
If you are running a reverse proxy you would use that to serve it.

#nginx

    location /robots.txt {
        alias /path/to/templates/robots.txt;
    }

or if just running apache

#apache
Alias /robots.txt /path/to/templates/robots.txt


On Thu, Nov 24, 2011 at 12:30 PM, Joe Esposito <espo58@gmail.com> wrote:
> What's the general consensus for setting static_url_path to an empty string?
> Or rather, what do you do for 'robots.txt', 'favicon.ico', and any other
> files expected to be at the root of the site?
>