librelist archives

« back to archive

unable to access blueprint static_folder in html file

unable to access blueprint static_folder in html file

From:
kracekumar ramaraju
Date:
2011-12-09 @ 17:49
Hi

  I am using blueprint .

In blaze/world/__init__.py

world_blueprint = Blueprint('world', 'blaze')

In blaze/__init__.py

def create_app():
      #required code for app registration
         world_blueprint.static_folder = "/path/to/custom/directory"
         app.register_blueprint(world_blueprint)

In template.html
url_for('world.static, filename="style.css") => world/static/style.css

But expected result /path/to/custom/directory/style.css

Note:
  By raise exception in views, world_blueprint.static_folder returns
expected result.(tried flask debugger)
-- 
*

Thanks & Regards
Kracekumar.R
*
*
*

Re: [flask] unable to access blueprint static_folder in html file

From:
Adam Patterson
Date:
2011-12-10 @ 06:32
do you want the filesystem path or you want the full url?

world_blueprint = Blueprint('world', 'blaze', _external=True)

will give you the full url.

On Sat, Dec 10, 2011 at 12:49 AM, kracekumar ramaraju
<kracethekingmaker@gmail.com> wrote:
> Hi
>
>   I am using blueprint .
>
> In blaze/world/__init__.py
>
> world_blueprint = Blueprint('world', 'blaze')
>
> In blaze/__init__.py
>
> def create_app():
>       #required code for app registration
>          world_blueprint.static_folder = "/path/to/custom/directory"
>          app.register_blueprint(world_blueprint)
>
> In template.html
> url_for('world.static, filename="style.css") => world/static/style.css
>
> But expected result /path/to/custom/directory/style.css
>
> Note:
>   By raise exception in views, world_blueprint.static_folder returns
> expected result.(tried flask debugger)
> --
>
> Thanks & Regards
> Kracekumar.R
>
>

Re: [flask] unable to access blueprint static_folder in html file

From:
kracekumar ramaraju
Date:
2011-12-10 @ 08:10
Hi

do you want the filesystem path or you want the full url?
>
> world_blueprint = Blueprint('world', 'blaze', _external=True)
>

I tried that, but there is no argument named  _external.

I cross verified with source code.


    def __init__(self, name, import_name, static_folder=None,
                 static_url_path=None, template_folder=None,
                 url_prefix=None, subdomain=None, url_defaults=None):



There is no _external argument,

Then I copied static folder in root app folder and I am using blue print so
url_for('static', filename='style.css') yields static/style.css
but after viewing source code

<link rel="stylesheet" href="/static/pretty.css
<http://localhost:5000/static/pretty.css>">

clicking the link points http://localhost:5000/static/pretty.css


Blueprint is driving me nuts especially this css stuff.


> will give you the full url.
>
> On Sat, Dec 10, 2011 at 12:49 AM, kracekumar ramaraju
> <kracethekingmaker@gmail.com> wrote:
> > Hi
> >
> >   I am using blueprint .
> >
> > In blaze/world/__init__.py
> >
> > world_blueprint = Blueprint('world', 'blaze')
> >
> > In blaze/__init__.py
> >
> > def create_app():
> >       #required code for app registration
> >          world_blueprint.static_folder = "/path/to/custom/directory"
> >          app.register_blueprint(world_blueprint)
> >
> > In template.html
> > url_for('world.static, filename="style.css") => world/static/style.css
> >
> > But expected result /path/to/custom/directory/style.css
> >
> > Note:
> >   By raise exception in views, world_blueprint.static_folder returns
> > expected result.(tried flask debugger)
> > --
> >
> > Thanks & Regards
> > Kracekumar.R
> >
> >
>



-- 
*
"Talk is cheap, show me the code" - Linus Torvalds
Winning Regards
KraceKumar.R
http://kracekumar.wordpress.com
+91-97906-58304
*
*+91-85530-29521*
*
*

Re: [flask] unable to access blueprint static_folder in html file

From:
kracekumar ramaraju
Date:
2011-12-10 @ 08:53
Hi

 Sorry, It was typo mistake, I fixed. My apology.



On Sat, Dec 10, 2011 at 1:40 PM, kracekumar ramaraju <
kracethekingmaker@gmail.com> wrote:

>
> Hi
>
> do you want the filesystem path or you want the full url?
>>
>> world_blueprint = Blueprint('world', 'blaze', _external=True)
>>
>
> I tried that, but there is no argument named  _external.
>
> I cross verified with source code.
>
>
>     def __init__(self, name, import_name, static_folder=None,
>                  static_url_path=None, template_folder=None,
>                  url_prefix=None, subdomain=None, url_defaults=None):
>
>
>
> There is no _external argument,
>
> Then I copied static folder in root app folder and I am using blue print
> so url_for('static', filename='style.css') yields static/style.css
> but after viewing source code
>
> <link rel="stylesheet" href="/static/pretty.css
> <http://localhost:5000/static/pretty.css>">
>
> clicking the link points http://localhost:5000/static/pretty.css
>
>
> Blueprint is driving me nuts especially this css stuff.
>
>
>> will give you the full url.
>>
>> On Sat, Dec 10, 2011 at 12:49 AM, kracekumar ramaraju
>> <kracethekingmaker@gmail.com> wrote:
>> > Hi
>> >
>> >   I am using blueprint .
>> >
>> > In blaze/world/__init__.py
>> >
>> > world_blueprint = Blueprint('world', 'blaze')
>> >
>> > In blaze/__init__.py
>> >
>> > def create_app():
>> >       #required code for app registration
>> >          world_blueprint.static_folder = "/path/to/custom/directory"
>> >          app.register_blueprint(world_blueprint)
>> >
>> > In template.html
>> > url_for('world.static, filename="style.css") => world/static/style.css
>> >
>> > But expected result /path/to/custom/directory/style.css
>> >
>> > Note:
>> >   By raise exception in views, world_blueprint.static_folder returns
>> > expected result.(tried flask debugger)
>> > --
>> >
>> > Thanks & Regards
>> > Kracekumar.R
>> >
>> >
>>
>
>
>
> --
> *
> "Talk is cheap, show me the code" - Linus Torvalds
> Winning Regards
> KraceKumar.R
> http://kracekumar.wordpress.com
> +91-97906-58304
> *
> *+91-85530-29521*
> *
> *
>
>


-- 
*
"Talk is cheap, show me the code" - Linus Torvalds
Winning Regards
KraceKumar.R
http://kracekumar.wordpress.com
+91-97906-58304
*
*+91-85530-29521*
*
*

Re: [flask] unable to access blueprint static_folder in html file

From:
Adam Patterson
Date:
2011-12-11 @ 09:11
also i think i was a bit drunk when i wrote that last email.

there is no _external on Blueprint obviously. Its on url_for.

Sorry for that

On Sat, Dec 10, 2011 at 3:53 PM, kracekumar ramaraju
<kracethekingmaker@gmail.com> wrote:
> Hi
>
>  Sorry, It was typo mistake, I fixed. My apology.
>
>
>
> On Sat, Dec 10, 2011 at 1:40 PM, kracekumar ramaraju
> <kracethekingmaker@gmail.com> wrote:
>>
>>
>> Hi
>>
>>> do you want the filesystem path or you want the full url?
>>>
>>> world_blueprint = Blueprint('world', 'blaze', _external=True)
>>
>>
>> I tried that, but there is no argument named  _external.
>>
>> I cross verified with source code.
>>
>>
>>     def __init__(self, name, import_name, static_folder=None,
>>
>>                  static_url_path=None, template_folder=None,
>>
>>                  url_prefix=None, subdomain=None, url_defaults=None):
>>
>>
>>
>> There is no _external argument,
>>
>> Then I copied static folder in root app folder and I am using blue print
>> so url_for('static', filename='style.css') yields static/style.css
>> but after viewing source code
>>
>> <link rel="stylesheet" href="/static/pretty.css ">
>>
>> clicking the link points http://localhost:5000/static/pretty.css
>>
>>
>> Blueprint is driving me nuts especially this css stuff.
>>
>>>
>>> will give you the full url.
>>>
>>> On Sat, Dec 10, 2011 at 12:49 AM, kracekumar ramaraju
>>> <kracethekingmaker@gmail.com> wrote:
>>> > Hi
>>> >
>>> >   I am using blueprint .
>>> >
>>> > In blaze/world/__init__.py
>>> >
>>> > world_blueprint = Blueprint('world', 'blaze')
>>> >
>>> > In blaze/__init__.py
>>> >
>>> > def create_app():
>>> >       #required code for app registration
>>> >          world_blueprint.static_folder = "/path/to/custom/directory"
>>> >          app.register_blueprint(world_blueprint)
>>> >
>>> > In template.html
>>> > url_for('world.static, filename="style.css") => world/static/style.css
>>> >
>>> > But expected result /path/to/custom/directory/style.css
>>> >
>>> > Note:
>>> >   By raise exception in views, world_blueprint.static_folder returns
>>> > expected result.(tried flask debugger)
>>> > --
>>> >
>>> > Thanks & Regards
>>> > Kracekumar.R
>>> >
>>> >
>>
>>
>>
>>
>> --
>> "Talk is cheap, show me the code" - Linus Torvalds
>> Winning Regards
>> KraceKumar.R
>> http://kracekumar.wordpress.com
>> +91-97906-58304
>> +91-85530-29521
>>
>>
>
>
>
> --
> "Talk is cheap, show me the code" - Linus Torvalds
> Winning Regards
> KraceKumar.R
> http://kracekumar.wordpress.com
> +91-97906-58304
> +91-85530-29521
>
>

Re: [flask] unable to access blueprint static_folder in html file

From:
kracekumar ramaraju
Date:
2011-12-11 @ 15:45
Hi

No issues :)

On Sun, Dec 11, 2011 at 2:41 PM, Adam Patterson <fakeempire@gmail.com>wrote:

> also i think i was a bit drunk when i wrote that last email.
>
> there is no _external on Blueprint obviously. Its on url_for.
>
> Sorry for that
>
> On Sat, Dec 10, 2011 at 3:53 PM, kracekumar ramaraju
> <kracethekingmaker@gmail.com> wrote:
> > Hi
> >
> >  Sorry, It was typo mistake, I fixed. My apology.
> >
> >
> >
> > On Sat, Dec 10, 2011 at 1:40 PM, kracekumar ramaraju
> > <kracethekingmaker@gmail.com> wrote:
> >>
> >>
> >> Hi
> >>
> >>> do you want the filesystem path or you want the full url?
> >>>
> >>> world_blueprint = Blueprint('world', 'blaze', _external=True)
> >>
> >>
> >> I tried that, but there is no argument named  _external.
> >>
> >> I cross verified with source code.
> >>
> >>
> >>     def __init__(self, name, import_name, static_folder=None,
> >>
> >>                  static_url_path=None, template_folder=None,
> >>
> >>                  url_prefix=None, subdomain=None, url_defaults=None):
> >>
> >>
> >>
> >> There is no _external argument,
> >>
> >> Then I copied static folder in root app folder and I am using blue print
> >> so url_for('static', filename='style.css') yields static/style.css
> >> but after viewing source code
> >>
> >> <link rel="stylesheet" href="/static/pretty.css ">
> >>
> >> clicking the link points http://localhost:5000/static/pretty.css
> >>
> >>
> >> Blueprint is driving me nuts especially this css stuff.
> >>
> >>>
> >>> will give you the full url.
> >>>
> >>> On Sat, Dec 10, 2011 at 12:49 AM, kracekumar ramaraju
> >>> <kracethekingmaker@gmail.com> wrote:
> >>> > Hi
> >>> >
> >>> >   I am using blueprint .
> >>> >
> >>> > In blaze/world/__init__.py
> >>> >
> >>> > world_blueprint = Blueprint('world', 'blaze')
> >>> >
> >>> > In blaze/__init__.py
> >>> >
> >>> > def create_app():
> >>> >       #required code for app registration
> >>> >          world_blueprint.static_folder = "/path/to/custom/directory"
> >>> >          app.register_blueprint(world_blueprint)
> >>> >
> >>> > In template.html
> >>> > url_for('world.static, filename="style.css") =>
> world/static/style.css
> >>> >
> >>> > But expected result /path/to/custom/directory/style.css
> >>> >
> >>> > Note:
> >>> >   By raise exception in views, world_blueprint.static_folder returns
> >>> > expected result.(tried flask debugger)
> >>> > --
> >>> >
> >>> > Thanks & Regards
> >>> > Kracekumar.R
> >>> >
> >>> >
> >>
> >>
> >>
> >>
> >> --
> >> "Talk is cheap, show me the code" - Linus Torvalds
> >> Winning Regards
> >> KraceKumar.R
> >> http://kracekumar.wordpress.com
> >> +91-97906-58304
> >> +91-85530-29521
> >>
> >>
> >
> >
> >
> > --
> > "Talk is cheap, show me the code" - Linus Torvalds
> > Winning Regards
> > KraceKumar.R
> > http://kracekumar.wordpress.com
> > +91-97906-58304
> > +91-85530-29521
> >
> >
>



-- 
*
"Talk is cheap, show me the code" - Linus Torvalds
Winning Regards
KraceKumar.R
http://kracekumar.wordpress.com
+91-97906-58304
*
*+91-85530-29521*
*
*