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
1 Answer
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.
flaskdata.pyin the question. Let us see what have you been trying to add the templates.