Avdhan Tyagi
Avdhan Tyagi

Reputation: 9

why ngrok does not display css in html webpage?

code and directory structure for files

The loaded webpage does not reflect styles.css on public url, this works fine for me localhost. I am running it on google-colab and trying to make a flask web app on it. how can i make index.html reflect the stylesheet?

I tried changing directories, and putting it in a 'static' directory in same folder as 'template' and changes stylesheet path to "../static/styles.css" still it did not work.

code :

from flask.templating import render_template
from flask import Flask
from flask_ngrok import run_with_ngrok
template_f = '/content/gdrive/MyDrive/Colab Notebooks/MyApp/template'
app = Flask(__name__, template_folder=template_f)
run_with_ngrok(app)
@app.route("/")
def home():
    return render_template('index.html')
a = app.run()

Upvotes: 1

Views: 341

Answers (0)

Related Questions