简体   繁体   中英

Local Flask - HTML Project Link to CSS and JS not Linking when run

I have started to work on my final project for CS50 by creating a web application. I started making all of the basic layouts to my html/css/javascript files on my local system, and installed flask locally to try it out. Although when I directly open the html files, it is linked up to the css and jaascript files, when I run it in flask, it gives me the error of "404 not found" for all of the css and javascript files I am trying to apply to the html.

Here is the code in my html file:

        <link rel="stylesheet" type="text/css" href="../styles/page_layout.css">
        <link rel="stylesheet" type="text/css" href="../styles/navbars.css">
        <link rel="stylesheet" type="text/css" href="../styles/styles.css">

The html files are in the templates folder, and I have a separate adjacent folder called "styles" for the css files and "javascript" for the js file. I tried every kind of formatting to this and cannot get it to work. Does anyone know why this might be? Thanks.

I have found out the appropriate syntax to get my web application to function as I wanted.

The answer I found here: CSS Problems with Flask Web App

I used the syntax provided and am not running into any issues anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM