python - Need basic help fixing external CSS stylesheet pathing in a Flask application -


sorry asking such basic question, i'm stuck , can't figure out doing wrong. developing small website using flask, teaching myself web coding along way.

i have following file structure:

mathsoc     mathsoc.py     mathsoc/templates         mathsoc.css         mathsoc_main.html         

my mathsoc.py looks this:

from flask import flask, render_template     app = flask(__name__)  @app.route("/") def main_page():     return render_template('mathsoc_main.html')  if __name__ == "__main__":     app.run(debug=true) 

then mathsoc_main.html looks this:

<!doctype html> <html lang="en"> <head>     <link rel="stylesheet" type="text/css" href="mathsoc.css"/>     <title>some title</title> </head>  <body> <div id="content"> hello world! </div> </body> </html> 

and mathsoc.css looks this:

#content {     width:46em;     background-color: yellow; } 

but mathsoc_main.html cannot find stylesheet, appears: not apply either of defined properties content. i'm guessing i'm doing wrong <link rel="stylesheet" type="text/css" href="mathsoc.css"/>, don't know what. seems blindingly obvious, yet no style loaded!

change folder structure include static folder.

mathsoc     mathsoc.py     templates         mathsoc_main.html     static         mathsoc.css 

see http://flask.pocoo.org/docs/0.10/tutorial/folders/


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -