python - How to use css styling in html with multiple directories? -


i'm trying make simple webapp using google appengine python, html, , css. know put .css styling separate file html 1 should use link tag, can't seem work. here general directory config:

main
├── app.yaml
├── files.py
├── folder
│ ├── files.py
│ ├── templates
│ │ ├── form.html
│ ├── static
│ │ ├── style.css

"form.html" contains layout , "style.css" contains styling. tried putting in code "style.css" directly "form.html" style tag , worked, when use link tag in head section of html file doesn't work. here link tags tried far:

<head>     <link type="text/css" rel="stylesheet" href="/static/style.css">     <title> ... </title> </head> 

or

<head>     <link type="text/css" rel="stylesheet" href="/folder/static/style.css">     <title> ... </title> </head> 

or

<head>     <link type="text/css" rel="stylesheet" href="/main/folder/static/style.css">     <title> ... </title> </head> 

none of these work, solution?

you need url handler in app.yaml:

- url: /static    static_dir: static/   secure: optional 

i not sure directory tree. if static nested inside folder, be:

- url: /folder/static    static_dir: folder/static/   secure: optional 

or, if static nested inside folder, , want simplify html links, then:

- url: /static  # <== url handle   static_dir: folder/static/  # <== point url   secure: optional 

and can access by:

<link type="text/css" rel="stylesheet" href="/static/style.css"> 

Comments