-2

I am trying to connect html and css files in flask app (pycharm ide) but not getting as how to do this.Here is the screenshot image link

i_love_pizza
  • 1
  • 2
  • 4
  • add code of `flaskdata.py` in the question. Let us see what have you been trying to add the templates. – arshovon Oct 11 '17 at 05:02

1 Answers1

0

In the template file to add CSS/JS use:

<link rel="stylesheet" href="{{ url_for('static', filename='main.css') }}">

In flaskdata.py (I assume this is the main file) render the template you have added:

from flask import render_template, flash, redirect, request, url_for
@app.route('/')
def index():
    return render_template('index.html')

Thus you can continue adding static CSS/JS files in the templates and render the required template in suitable routings.

arshovon
  • 13,270
  • 9
  • 51
  • 69