librelist archives

« back to archive

Flask Blueprints Static

Flask Blueprints Static

From:
lynadge
Date:
2012-07-11 @ 19:15
Hi guys,

i try to solve this problem and found no solution...

I want to use static files in a blueprint but i don't get it!

I can't find any sample code. The ones in the flask.doc are not very 
helpful.

This is my current work: 
https://github.com/haengebruegge/flaskeleton/tree/blueprint_static

I also found a issue but it don't helpd: 
https://github.com/mitsuhiko/flask/issues/348

Re: [flask] Flask Blueprints Static

From:
lynadge
Date:
2012-07-14 @ 07:12
So, i solved this problem by seperating the pages blueprint in to 
blueprints. One without url_prefix and one with url_prefix. In the first 
one the view functions/template do not need static files from the 
blueprint. The second one will do it.

Thats my little workaround.

Am 11.07.2012 20:15, schrieb lynadge:
> Hi guys,
>
> i try to solve this problem and found no solution...
>
> I want to use static files in a blueprint but i don't get it!
>
> I can't find any sample code. The ones in the flask.doc are not very
> helpful.
>
> This is my current work:
> https://github.com/haengebruegge/flaskeleton/tree/blueprint_static
>
> I also found a issue but it don't helpd:
> https://github.com/mitsuhiko/flask/issues/348

Re: [flask] Flask Blueprints Static

From:
Smartboy
Date:
2012-07-11 @ 19:40
The documentation seems to be very clear about how to use static files. See
here:  http://flask.pocoo.org/docs/blueprints/#static-files Basically, just
use url_for to get the static files you want as long as they are in a
folder called "static" in your blueprints directory.

Maybe you can tell us what exactly you are having problems with?

Smartboy

On Wed, Jul 11, 2012 at 12:15 PM, lynadge <lynadge@barfooz.de> wrote:

> Hi guys,
>
> i try to solve this problem and found no solution...
>
> I want to use static files in a blueprint but i don't get it!
>
> I can't find any sample code. The ones in the flask.doc are not very
> helpful.
>
> This is my current work:
> https://github.com/haengebruegge/flaskeleton/tree/blueprint_static
>
> I also found a issue but it don't helpd:
> https://github.com/mitsuhiko/flask/issues/348
>

Re: [flask] Flask Blueprints Static

From:
lynadge
Date:
2012-07-12 @ 16:38
I testet the Version in the doku, it didn't work.

There is also no error message. With 'url_prefix' it will work, but for 
this blueprint the 'url_prefix' is useless for me. :/

Am 11.07.2012 20:40, schrieb Smartboy:
> The documentation seems to be very clear about how to use static
> files. See here: 
> http://flask.pocoo.org/docs/blueprints/#static-files [3] Basically,
> just use url_for to get the static files you want as long as they are
> in a folder called "static" in your blueprints directory.
>
> Maybe you can tell us what exactly you are having problems with?
>
> Smartboy
>
> On Wed, Jul 11, 2012 at 12:15 PM, lynadge <lynadge@barfooz.de [4]>
> wrote:
>
>> Hi guys,
>>
>> i try to solve this problem and found no solution...
>>
>> I want to use static files in a blueprint but i don't get it!
>>
>> I can't find any sample code. The ones in the flask.doc are not
>> very
>> helpful.
>>
>> This is my current work:
>> https://github.com/haengebruegge/flaskeleton/tree/blueprint_static
>> [1]
>>
>> I also found a issue but it don't helpd:
>> https://github.com/mitsuhiko/flask/issues/348 [2]
>
>
>
> Links:
> ------
> [1] 
> https://github.com/haengebruegge/flaskeleton/tree/blueprint_static
> [2] https://github.com/mitsuhiko/flask/issues/348
> [3] http://flask.pocoo.org/docs/blueprints/#static-files
> [4] mailto:lynadge@barfooz.de

Re: [flask] Flask Blueprints Static

From:
Budi Arief Gusandi
Date:
2012-07-12 @ 16:51
This is the same issue i encountered. Rather than stucked with this trivial
thing, i just hardcoded all the url in templates and avoided using
url_for().

I used <base href="ur_root_url" /> in header template, so i did not have to
write complete url, simply <img src="assets/images/logo.jpg" />

Regards,
On Jul 12, 2012 11:38 PM, lynadge <lynadge@barfooz.de> wrote:

> I testet the Version in the doku, it didn't work.
>
> There is also no error message. With 'url_prefix' it will work, but for
> this blueprint the 'url_prefix' is useless for me. :/

Re: [flask] Flask Blueprints Static

From:
lynadge
Date:
2012-07-12 @ 06:11
Hi,

i realy tried. But it dit not work. The problem is, that i dit not use 
'url_prefix' for my pages blueprint. With the 'url_prefix' it worked. So 
i think i need a workaround ore something to use the static files 
without an 'url_prefix'.

Am 11.07.2012 20:40, schrieb Smartboy:
> The documentation seems to be very clear about how to use static
> files. See here: 
> http://flask.pocoo.org/docs/blueprints/#static-files [3] Basically,
> just use url_for to get the static files you want as long as they are
> in a folder called "static" in your blueprints directory.
>
> Maybe you can tell us what exactly you are having problems with?
>
> Smartboy
>
> On Wed, Jul 11, 2012 at 12:15 PM, lynadge <lynadge@barfooz.de [4]>
> wrote:
>
>> Hi guys,
>>
>> i try to solve this problem and found no solution...
>>
>> I want to use static files in a blueprint but i don't get it!
>>
>> I can't find any sample code. The ones in the flask.doc are not
>> very
>> helpful.
>>
>> This is my current work:
>> https://github.com/haengebruegge/flaskeleton/tree/blueprint_static
>> [1]
>>
>> I also found a issue but it don't helpd:
>> https://github.com/mitsuhiko/flask/issues/348 [2]
>
>
>
> Links:
> ------
> [1] 
> https://github.com/haengebruegge/flaskeleton/tree/blueprint_static
> [2] https://github.com/mitsuhiko/flask/issues/348
> [3] http://flask.pocoo.org/docs/blueprints/#static-files
> [4] mailto:lynadge@barfooz.de