Hi! I could need some advice with this code. I want this README.md-file rendered on my site. It works perfectly for some minutes, and then it starts only showing Image Alt Text instead. This is my first time trying flask. Do I need to do something special for it to be rendered permanently? Any advice is helpful
Best,
My flask_app.py python-file looks like this:
import markdown
from flask import Flask
import markdown.extensions.fenced_code
app = Flask(__name__)
@app.route("/")
def index():
readme_file = open("/home/username/mysite/README.md", "r")
md_template_string = markdown.markdown(
readme_file.read(), extensions=["fenced_code"]
)
return md_template_string
And I use the standard wsgi.py-file to import it, with:
# This file contains the WSGI configuration required to serve up your
# web application at http://<your-username>.pythonanywhere.com/
# It works by setting the variable 'application' to a WSGI handler of some
# description.
#
# The below has been auto-generated for your Flask project
import sys
# add your project directory to the sys.path
project_home = '/home/username/mysite'
if project_home not in sys.path:
sys.path = [project_home] + sys.path
# import flask app but need to call it "application" for WSGI to work
from flask_app import app as application # noqa