librelist archives

« back to archive

Serving static files with dev server

Serving static files with dev server

From:
Michael Hipp
Date:
2014-02-14 @ 14:52
I've read http://flask.pocoo.org/docs/quickstart/#static-files where it shows 
this:

     url_for('static', filename='style.css')

Two questions:
- Where in my program do I put the 'url_for()' line?

- Do I have to make a separate line like that for every file in /static ?

Thanks,
Michael

Re: [flask] Serving static files with dev server

From:
Viktor Evdokimov
Date:
2014-02-14 @ 15:02
Also check http://flask.pocoo.org/docs/quickstart/#url-building section of
docs, it explain url_for in details


--  
Best,   
ᏛᎧ




On Friday, February 14, 2014 at 9:52 AM, Michael Hipp wrote:

> I've read http://flask.pocoo.org/docs/quickstart/#static-files where it shows  
> this:
>  
> url_for('static', filename='style.css')
>  
> Two questions:
> - Where in my program do I put the 'url_for()' line?
>  
> - Do I have to make a separate line like that for every file in /static ?
>  
> Thanks,
> Michael
>  
>  

Re: [flask] Serving static files with dev server

From:
Michael Hipp
Date:
2014-02-14 @ 15:36
(Ok, maybe I've figured out how to get thunderbird to send in plain text. Never 
seen this before. It doesn't do this when I send the reply only to myself. Weird.)

Thanks for the link but it still doesn't tell where to put url_for() in the 
program.

Thanks,
Michael


On 2/14/2014 9:02 AM, Viktor Evdokimov wrote:
> Also check http://flask.pocoo.org/docs/quickstart/#url-building section of 
> docs, it explain url_for in details
>
>
> -- 
> Best,
> _Ꮫ ^Ꭷ
>
> On Friday, February 14, 2014 at 9:52 AM, Michael Hipp wrote:
>
>> I've read http://flask.pocoo.org/docs/quickstart/#static-files where it shows
>> this:
>>
>> url_for('static', filename='style.css')
>>
>> Two questions:
>> - Where in my program do I put the 'url_for()' line?
>>
>> - Do I have to make a separate line like that for every file in /static ?
>>
>> Thanks,
>> Michael
>

Re: [flask] Serving static files with dev server

From:
Matthias Urlichs
Date:
2014-02-14 @ 16:32
Hi,

Michael Hipp:
> Thanks for the link but it still doesn't tell where to put url_for() in the 
> program.
> 
You put it in the template, or as the argument to redirect().

-- 
-- Matthias Urlichs

Re: [flask] Serving static files with dev server

From:
Michael Hipp
Date:
2014-02-14 @ 15:13
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Thanks. It still doesn't tell where to
      put url_for() in the program.<br>
      <br>
      Thanks,<br>
      Michael<br>
      <br>
      <br>
      On 2/14/2014 9:02 AM, Viktor Evdokimov wrote:<br>
    </div>
    <blockquote cite="mid:BC1A992D0C194CD0996D12012652C7BD@gmail.com"
      type="cite">
      <div style="font-family: Helvetica; font-size: 13px;">Also check <a
          moz-do-not-send="true"
          
href="http://flask.pocoo.org/docs/quickstart/#url-building">http://flask.pocoo.org/docs/quickstart/#url-building</a> section
        of docs, it explain url_for in details<br>
      </div>
      <div>
        <div><br>
        </div>
        <br>
        <div>
          <div style="background-color: rgb(255, 255, 255); ">-- </div>
          <div style="background-color: rgb(255, 255, 255); ">Best,<span
              style="font-size: 21px; ">  </span></div>
          <div style="background-color: rgb(255, 255, 255); ">
            <div style="font-size: 36px; "><sub>Ꮫ</sub><sup>Ꭷ</sup></div>
          </div>
        </div>
      </div>
      <p style="color: #A0A0A8;">On Friday, February 14, 2014 at 9:52
        AM, Michael Hipp wrote:</p>
      <blockquote type="cite"

style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
        <span>
          <div>
            <div>
              <div>I've read <a moz-do-not-send="true"
                  
href="http://flask.pocoo.org/docs/quickstart/#static-files">http://flask.pocoo.org/docs/quickstart/#static-files</a>
                where it shows </div>
              <div>this:</div>
              <div><br>
              </div>
              <div> url_for('static', filename='style.css')</div>
              <div><br>
              </div>
              <div>Two questions:</div>
              <div>- Where in my program do I put the 'url_for()' line?</div>
              <div><br>
              </div>
              <div>- Do I have to make a separate line like that for
                every file in /static ?</div>
              <div><br>
              </div>
              <div>Thanks,</div>
              <div>Michael</div>
            </div>
          </div>
        </span> </blockquote>
      <div> <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>

Re: [flask] Serving static files with dev server

From:
Michael Hipp
Date:
2014-02-14 @ 15:28
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">(Sorry for the html noise, not sure
      what thunderbird is doing.)<br>
      <br>
      Thanks for the link but it still doesn't tell me where to put
      url_for() in the program.<br>
      <br>
      Thanks,<br>
      Michael<br>
      <br>
      <br>
      On 2/14/2014 9:02 AM, Viktor Evdokimov wrote:<br>
    </div>
    <blockquote cite="mid:BC1A992D0C194CD0996D12012652C7BD@gmail.com"
      type="cite">
      <div style="font-family: Helvetica; font-size: 13px;">Also check <a
          moz-do-not-send="true"
          
href="http://flask.pocoo.org/docs/quickstart/#url-building">http://flask.pocoo.org/docs/quickstart/#url-building</a> section
        of docs, it explain url_for in details<br>
      </div>
      <div>
        <div><br>
        </div>
        <br>
        <div>
          <div style="background-color: rgb(255, 255, 255); ">-- </div>
          <div style="background-color: rgb(255, 255, 255); ">Best,  </div>
          <div style="background-color: rgb(255, 255, 255); ">
            <div style="font-size: 36px; ">ᏛᎧ</div>
          </div>
        </div>
      </div>
      <p style="color: #A0A0A8;">On Friday, February 14, 2014 at 9:52
        AM, Michael Hipp wrote:</p>
      <blockquote type="cite"

style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
        <div>
          <div>
            <div>I've read <a moz-do-not-send="true"
                
href="http://flask.pocoo.org/docs/quickstart/#static-files">http://flask.pocoo.org/docs/quickstart/#static-files</a>
              where it shows </div>
            <div>this:</div>
            <div><br>
            </div>
            <div> url_for('static', filename='style.css')</div>
            <div><br>
            </div>
            <div>Two questions:</div>
            <div>- Where in my program do I put the 'url_for()' line?</div>
            <div><br>
            </div>
            <div>- Do I have to make a separate line like that for every
              file in /static ?</div>
            <div><br>
            </div>
            <div>Thanks,</div>
            <div>Michael</div>
          </div>
        </div>
      </blockquote>
      <div> <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>

Re: [flask] Serving static files with dev server

From:
Viktor Evdokimov
Date:
2014-02-14 @ 15:36
Michael,

two typical cases are

first case:

view.py:

@app.route(‘/‘)
def index():     
    return render_template(‘index.html’, style_url = url_for(‘static’, 
‘style.css’))

index.html template:

    <link rel="stylesheet" href=“{{ style_url }}" type="text/css" />


second case:

index.html template:
   
   <link rel="stylesheet" href=“{% url_for(’static’, filename=’style.css’)
%}" type="text/css" />



--  
Best,   
ᏛᎧ




On Friday, February 14, 2014 at 10:28 AM, Michael Hipp wrote:

> <html>
> <head>
> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
> </head>
> <body bgcolor="#FFFFFF" text="#000000">
> <div class="moz-cite-prefix">(Sorry for the html noise, not sure
> what thunderbird is doing.)<br>
> <br>
> Thanks for the link but it still doesn't tell me where to put
> url_for() in the program.<br>
> <br>
> Thanks,<br>
> Michael<br>
> <br>
> <br>
> On 2/14/2014 9:02 AM, Viktor Evdokimov wrote:<br>
> </div>
> <blockquote cite="mid:BC1A992D0C194CD0996D12012652C7BD@gmail.com 
(mailto:BC1A992D0C194CD0996D12012652C7BD@gmail.com)"
> type="cite">
> <div style="font-family: Helvetica; font-size: 13px;">Also check <a
> moz-do-not-send="true"
> 
href="http://flask.pocoo.org/docs/quickstart/#url-building">http://flask.pocoo.org/docs/quickstart/#url-building</a>
section
> of docs, it explain url_for in details<br>
> </div>
> <div>
> <div><br>
> </div>
> <br>
> <div>
> <div style="background-color: rgb(255, 255, 255); ">-- </div>
> <div style="background-color: rgb(255, 255, 255); ">Best,  </div>
> <div style="background-color: rgb(255, 255, 255); ">
> <div style="font-size: 36px; ">ᏛᎧ</div>
> </div>
> </div>
> </div>
> <p style="color: #A0A0A8;">On Friday, February 14, 2014 at 9:52
> AM, Michael Hipp wrote:</p>
> <blockquote type="cite"
> 
style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
> <div>
> <div>
> <div>I've read <a moz-do-not-send="true"
> 
href="http://flask.pocoo.org/docs/quickstart/#static-files">http://flask.pocoo.org/docs/quickstart/#static-files</a>
> where it shows </div>
> <div>this:</div>
> <div><br>
> </div>
> <div> url_for('static', filename='style.css')</div>
> <div><br>
> </div>
> <div>Two questions:</div>
> <div>- Where in my program do I put the 'url_for()' line?</div>
> <div><br>
> </div>
> <div>- Do I have to make a separate line like that for every
> file in /static ?</div>
> <div><br>
> </div>
> <div>Thanks,</div>
> <div>Michael</div>
> </div>
> </div>
> </blockquote>
> <div> <br>
> </div>
> </blockquote>
> <br>
> </body>
> </html>
>  
>  

Re: [flask] Serving static files with dev server

From:
Michael Hipp
Date:
2014-02-14 @ 16:08
Getting this exception:

     File "C:\dev\oldworldblack\templates\index.html", line 4, in template
     <link rel="stylesheet" href="{% url_for('static', filename='app.css') %}" 
type="text/css" />
     TemplateSyntaxError: Encountered unknown tag 'url_for'.

Python:
     @app.route('/')
     def static_index():
         return render_template('index.html')

index.html:
<!doctype html>
<html lang="en" ng-app>
<head>
   <link rel="stylesheet" href="{% url_for('static', filename='app.css') %}" 
type="text/css" />
</head>
<body>
</body>
</html>

Do I have some obvious typo or bug in the above?

Thanks,
Michael



On 2/14/2014 9:36 AM, Viktor Evdokimov wrote:
> Michael,
>
> two typical cases are
>
> *first case:*
>
> view.py:
>
> @app.route(‘/‘)
> def index():
>     return render_template(‘index.html’, style_url = url_for(‘static’, 
> ‘style.css’))
>
> index.html template:
>
> <link rel="stylesheet" href=“{{ style_url }}" type="text/css" />
>
>
> *second case:*
>
> index.html template:
> <link rel="stylesheet" href=“{% url_for(’static’, filename=’style.css’) %}" 
> type="text/css" />
>
> < /span>
>
>
> -- 
> Best,
> _Ꮫ ^Ꭷ
>
> On Friday, February 14, 2014 at 10:28 AM, Michael Hipp wrote:
>
>> <html>
>> <head>
>> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
>> </head>
>> <body bgcolor="#FFFFFF" text="#000000">
>> <div class="moz-cite-prefix">(Sorry for the html noise, not sure
>> what thunderbird is doing.)<br>
>> <br>
>> Thanks for the link but it still doesn't tell me where to put
>> url_for() in the program.<br>
>> <br>
>> Thanks,<br>
>> Michael<br>
>> <br>
>> <br>
>> On 2/14/2014 9:02 AM, Viktor Evdokimov wrote:<br>
>> </div>
>> <blockquote cite="mid:BC1A992D0C194CD0996D12012652C7BD@gmail.com 
>> <mailto:BC1A992D0C194CD0996D12012652C7BD@gmail.com>"
>> type="cite">
>> <div style="font-family: Helvetica; font-size: 13px;">Also check <a
>> moz-do-not-send="true"
>> 
href="http://flask.pocoo.org/docs/quickstart/#url-building">http://flask.pocoo.org/docs/quickstart/#url-building</a>
section
>> of docs, it explain url_for in details<br>
>> </div>
>> <div>
>> <div><br>
>> </div>
>> <br>
>> <div>
>> <div style="background-color: rgb(255, 255, 255); ">-- </div>
>> <div style="background-color: rgb(255, 255, 255); ">Best,  </div>
>> <div style="background-color: rgb(255, 255, 255); ">
>> <div style="font-size: 36px; ">ᏛᎧ</div>
>> </div>
>> </div>
>> </div>
>> <p style="color: #A0A0A8;">On Friday, February 14, 2014 at 9:52
>> AM, Michael Hipp wrote:</p>
>> <blockquote type="cite"
>> 
style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
>> <div>
>> <div>
>> <div>I've read <a moz-do-not-send="true"
>> 
href="http://flask.pocoo.org/docs/quickstart/#static-files">http://flask.pocoo.org/docs/quickstart/#static-files</a>
>> where it shows </div>
>> <div>this:</div>
>> <div><br>
>> </ div>
>> <div> url_for('static', filename='style.css')</div>
>> <div><br>
>> </div>
>> <div>Two questions:</div>
>> <div>- Where in my program do I put the 'url_for()' line?</div>
>> <div><br>
>> </div>
>> <div>- Do I have to make a separate line like that for every
>> file in /static ?</div>
>> <div><br>
>> </div>
>> <div>Thanks,</div>
>> <div>Michael</div>
>> </div>
>> </div>
>> </blockquote>
>> <div> <br>
>> </div>
>> </blockquote>
>> <br>
>> </body>
>> < div></html>
>

Re: [flask] Serving static files with dev server

From:
Farhan
Date:
2014-02-14 @ 16:38
It’s a typo. The line should be:

<link rel="stylesheet" href=“{{ url_for('static', filename='app.css') }}” 

Note the absence of the “%” sign.

Best,
Farhan

On Feb 14, 2014, at 8:08 AM, Michael Hipp <michael@redmule.com> wrote:

> Getting this exception:
> 
>     File "C:\dev\oldworldblack\templates\index.html", line 4, in template
>     <link rel="stylesheet" href="{% url_for('static', filename='app.css') %}" 
> type="text/css" />
>     TemplateSyntaxError: Encountered unknown tag 'url_for'.
> 
> Python:
>     @app.route('/')
>     def static_index():
>         return render_template('index.html')
> 
> index.html:
> <!doctype html>
> <html lang="en" ng-app>
> <head>
>   <link rel="stylesheet" href="{% url_for('static', filename='app.css') %}" 
> type="text/css" />
> </head>
> <body>
> </body>
> </html>
> 
> Do I have some obvious typo or bug in the above?
> 
> Thanks,
> Michael
> 
> 
> 
> On 2/14/2014 9:36 AM, Viktor Evdokimov wrote:
>> Michael,
>> 
>> two typical cases are
>> 
>> *first case:*
>> 
>> view.py:
>> 
>> @app.route(‘/‘)
>> def index():
>>    return render_template(‘index.html’, style_url = url_for(‘static’, 
>> ‘style.css’))
>> 
>> index.html template:
>> 
>> <link rel="stylesheet" href=“{{ style_url }}" type="text/css" />
>> 
>> 
>> *second case:*
>> 
>> index.html template:
>> <link rel="stylesheet" href=“{% url_for(’static’, filename=’style.css’) %}" 
>> type="text/css" />
>> 
>> < /span>
>> 
>> 
>> -- 
>> Best,
>> _Ꮫ ^Ꭷ
>> 
>> On Friday, February 14, 2014 at 10:28 AM, Michael Hipp wrote:
>> 
>>> <html>
>>> <head>
>>> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
>>> </head>
>>> <body bgcolor="#FFFFFF" text="#000000">
>>> <div class="moz-cite-prefix">(Sorry for the html noise, not sure
>>> what thunderbird is doing.)<br>
>>> <br>
>>> Thanks for the link but it still doesn't tell me where to put
>>> url_for() in the program.<br>
>>> <br>
>>> Thanks,<br>
>>> Michael<br>
>>> <br>
>>> <br>
>>> On 2/14/2014 9:02 AM, Viktor Evdokimov wrote:<br>
>>> </div>
>>> <blockquote cite="mid:BC1A992D0C194CD0996D12012652C7BD@gmail.com 
>>> <mailto:BC1A992D0C194CD0996D12012652C7BD@gmail.com>"
>>> type="cite">
>>> <div style="font-family: Helvetica; font-size: 13px;">Also check <a
>>> moz-do-not-send="true"
>>> 
href="http://flask.pocoo.org/docs/quickstart/#url-building">http://flask.pocoo.org/docs/quickstart/#url-building</a>
section
>>> of docs, it explain url_for in details<br>
>>> </div>
>>> <div>
>>> <div><br>
>>> </div>
>>> <br>
>>> <div>
>>> <div style="background-color: rgb(255, 255, 255); ">-- </div>
>>> <div style="background-color: rgb(255, 255, 255); ">Best,  </div>
>>> <div style="background-color: rgb(255, 255, 255); ">
>>> <div style="font-size: 36px; ">ᏛᎧ</div>
>>> </div>
>>> </div>
>>> </div>
>>> <p style="color: #A0A0A8;">On Friday, February 14, 2014 at 9:52
>>> AM, Michael Hipp wrote:</p>
>>> <blockquote type="cite"
>>> 
style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
>>> <div>
>>> <div>
>>> <div>I've read <a moz-do-not-send="true"
>>> 
href="http://flask.pocoo.org/docs/quickstart/#static-files">http://flask.pocoo.org/docs/quickstart/#static-files</a>
>>> where it shows </div>
>>> <div>this:</div>
>>> <div><br>
>>> </ div>
>>> <div> url_for('static', filename='style.css')</div>
>>> <div><br>
>>> </div>
>>> <div>Two questions:</div>
>>> <div>- Where in my program do I put the 'url_for()' line?</div>
>>> <div><br>
>>> </div>
>>> <div>- Do I have to make a separate line like that for every
>>> file in /static ?</div>
>>> <div><br>
>>> </div>
>>> <div>Thanks,</div>
>>> <div>Michael</div>
>>> </div>
>>> </div>
>>> </blockquote>
>>> <div> <br>
>>> </div>
>>> </blockquote>
>>> <br>
>>> </body>
>>> < div></html>
>> 
> 
> 

Re: [flask] Serving static files with dev server

From:
Marcello Bachechi
Date:
2014-02-14 @ 16:45
2



On Fri, Feb 14, 2014 at 9:38 AM, Farhan <inshany@gmail.com> wrote:

> It’s a typo. The line should be:
>
> <link rel="stylesheet" href=“{{ url_for('static', filename='app.css') }}”
>
> Note the absence of the “%” sign.
>
> Best,
> Farhan
>
> On Feb 14, 2014, at 8:08 AM, Michael Hipp <michael@redmule.com> wrote:
>
> > Getting this exception:
> >
> >     File "C:\dev\oldworldblack\templates\index.html", line 4, in template
> >     <link rel="stylesheet" href="{% url_for('static',
> filename='app.css') %}"
> > type="text/css" />
> >     TemplateSyntaxError: Encountered unknown tag 'url_for'.
> >
> > Python:
> >     @app.route('/')
> >     def static_index():
> >         return render_template('index.html')
> >
> > index.html:
> > <!doctype html>
> > <html lang="en" ng-app>
> > <head>
> >   <link rel="stylesheet" href="{% url_for('static', filename='app.css')
> %}"
> > type="text/css" />
> > </head>
> > <body>
> > </body>
> > </html>
> >
> > Do I have some obvious typo or bug in the above?
> >
> > Thanks,
> > Michael
> >
> >
> >
> > On 2/14/2014 9:36 AM, Viktor Evdokimov wrote:
> >> Michael,
> >>
> >> two typical cases are
> >>
> >> *first case:*
> >>
> >> view.py:
> >>
> >> @app.route(‘/‘)
> >> def index():
> >>    return render_template(‘index.html’, style_url = url_for(‘static’,
> >> ‘style.css’))
> >>
> >> index.html template:
> >>
> >> <link rel="stylesheet" href=“{{ style_url }}" type="text/css" />
> >>
> >>
> >> *second case:*
> >>
> >> index.html template:
> >> <link rel="stylesheet" href=“{% url_for(’static’, filename=’style.css’)
> %}"
> >> type="text/css" />
> >>
> >> < /span>
> >>
> >>
> >> --
> >> Best,
> >> _Ꮫ ^Ꭷ
> >>
> >> On Friday, February 14, 2014 at 10:28 AM, Michael Hipp wrote:
> >>
> >>> <html>
> >>> <head>
> >>> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
> >>> </head>
> >>> <body bgcolor="#FFFFFF" text="#000000">
> >>> <div class="moz-cite-prefix">(Sorry for the html noise, not sure
> >>> what thunderbird is doing.)<br>
> >>> <br>
> >>> Thanks for the link but it still doesn't tell me where to put
> >>> url_for() in the program.<br>
> >>> <br>
> >>> Thanks,<br>
> >>> Michael<br>
> >>> <br>
> >>> <br>
> >>> On 2/14/2014 9:02 AM, Viktor Evdokimov wrote:<br>
> >>> </div>
> >>> <blockquote cite="mid:BC1A992D0C194CD0996D12012652C7BD@gmail.com
> >>> <mailto:BC1A992D0C194CD0996D12012652C7BD@gmail.com>"
> >>> type="cite">
> >>> <div style="font-family: Helvetica; font-size: 13px;">Also check <a
> >>> moz-do-not-send="true"
> >>> href="http://flask.pocoo.org/docs/quickstart/#url-building">
> http://flask.pocoo.org/docs/quickstart/#url-building</a> section
> >>> of docs, it explain url_for in details<br>
> >>> </div>
> >>> <div>
> >>> <div><br>
> >>> </div>
> >>> <br>
> >>> <div>
> >>> <div style="background-color: rgb(255, 255, 255); ">-- </div>
> >>> <div style="background-color: rgb(255, 255, 255); ">Best,  </div>
> >>> <div style="background-color: rgb(255, 255, 255); ">
> >>> <div style="font-size: 36px; ">ᏛᎧ</div>
> >>> </div>
> >>> </div>
> >>> </div>
> >>> <p style="color: #A0A0A8;">On Friday, February 14, 2014 at 9:52
> >>> AM, Michael Hipp wrote:</p>
> >>> <blockquote type="cite"
> >>>
> 
style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
> >>> <div>
> >>> <div>
> >>> <div>I've read <a moz-do-not-send="true"
> >>> href="http://flask.pocoo.org/docs/quickstart/#static-files">
> http://flask.pocoo.org/docs/quickstart/#static-files</a>
> >>> where it shows </div>
> >>> <div>this:</div>
> >>> <div><br>
> >>> </ div>
> >>> <div> url_for('static', filename='style.css')</div>
> >>> <div><br>
> >>> </div>
> >>> <div>Two questions:</div>
> >>> <div>- Where in my program do I put the 'url_for()' line?</div>
> >>> <div><br>
> >>> </div>
> >>> <div>- Do I have to make a separate line like that for every
> >>> file in /static ?</div>
> >>> <div><br>
> >>> </div>
> >>> <div>Thanks,</div>
> >>> <div>Michael</div>
> >>> </div>
> >>> </div>
> >>> </blockquote>
> >>> <div> <br>
> >>> </div>
> >>> </blockquote>
> >>> <br>
> >>> </body>
> >>> < div></html>
> >>
> >
> >
>
>


-- 
Sincerely,
Marcello Bachechi.

CelloCakes.com <http:/www.cellocakes.com>

ondeckshooting.com  URL soon to be operational

Learn to sign

Re: [flask] Serving static files with dev server

From:
Viktor Evdokimov
Date:
2014-02-14 @ 15:00
That is syntax for views , i.e. head.html would have:

   …. <link rel="stylesheet" href=“{% url_for(’static’, 
filename=’style.css’) %}" type="text/css" />

and yes, for any file you reference in a view you are going to call url_for

on the other hand only thing you have to do to setup folder for static 
files is (from your link)

Just create a folder called staticin your package or next to your module 
and it will be available at /static on the application.



--  
Best,   
ᏛᎧ




On Friday, February 14, 2014 at 9:52 AM, Michael Hipp wrote:

> I've read http://flask.pocoo.org/docs/quickstart/#static-files where it shows  
> this:
>  
> url_for('static', filename='style.css')
>  
> Two questions:
> - Where in my program do I put the 'url_for()' line?
>  
> - Do I have to make a separate line like that for every file in /static ?
>  
> Thanks,
> Michael
>  
>