title: How to get Flask recognise the CSS and JS files in the static folder?
body: <p>I can't get flask run my css and js files. It just opens a page where all the images are missing and all the textfields and buttons etc. are all over the place. So I found out that the relevant files need to be in the static folder and the path has to be adjusted accordingly like at <a href="https://stackoverflow.com/questions/13772884/css-problems-with-flask-web-app">CSS Problems with Flask Web App</a> or at <a href="https://stackoverflow.com/questions/14711552/external-javascript-file-is-not-getting-added-when-running-on-flask">External JavaScript file is not getting added when running on Flask</a>. I implemented this. But it didn't really help. Apparently it's a common problem. I've tried a few other suggestions/solutions mostly focusing on the snytax and parentheses etc. here on stackoverflow but none helped. So my folder structure is this:</p>
  
  <pre><code>
    /myproject
        /static
           /css_image
              script.js
              img1.png
              asdf.css
        /templates
           index.html
        app.py
  </code></pre>
  
  <p>Here are  a few lines from the HTML-Code for the above paths:  </p>
  
  <pre><code>&lt;link rel="stylesheet" media="all" href="{{ url_for('static', filename='css_image/asdf.css')}}"&gt;
  &lt;link rel="apple-touch-icon" sizes="57x57" href="{{ url_for('static', filename='css_image/img1.png')}}"&gt;
  &lt;script  src="{{ url_for('static', filename='css_image/script.js')}}" data-turbolinks-track="reload"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>My python-flask code looks like this:</p>
  
  <pre><code>from flask import Flask, url_for, render_template
  
  app = Flask(__name__)
  
  
  @app.route('/')
  def index():
      return render_template("index.html")
  
  if __name__ == '__main__':
      app.run()
  </code></pre>
  
  <p>After I run the flask, I get the following on the output:</p>
  
  <pre><code>127.0.0.1 - - [07/Oct/2019 14:10:06] "GET / HTTP/1.1" 200 -
  127.0.0.1 - - [07/Oct/2019 14:10:06] "GET /static/css_image/img1.png HTTP/1.1" 404 -
  127.0.0.1 - - [07/Oct/2019 14:10:06] "GET /static/css_image/asdf.css HTTP/1.1" 404 -
  127.0.0.1 - - [07/Oct/2019 14:10:06] "GET /static/css_image/script.js HTTP/1.1" 404 -
  </code></pre>
  
  <p>I should also add, the html file is working just fine, when I open it directly by clicking on the file.</p>