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
Comments
Post a Comment