heirloom Posted August 14, 2020 Posted August 14, 2020 (edited) I have an app with static paths like this: import sys import platform from flask import Flask, __version__ app = Flask(__name__) @app.route("/") def hello(): return """ Hello World!<br><br> <a href="/info/">System Information</a> """ @app.route("/info/") def info(): return f""" Platform: {platform.platform()}<br> Python version {sys.version}<br> Flask version: {__version__} """ if __name__ == "__main__": app.run()But when I use it in heliohost the links have to be prefixed with '/flask/'. Is there a way to do this without having to change all the links in the application? Edited August 14, 2020 by heirloom
Krydos Posted August 15, 2020 Posted August 15, 2020 Are you asking about how to run flask in your web root instead of a subdirectory? You just move all your files from public_html/flask/ to public_html/ and then update your .htaccess and flask.wsgi paths to match. The reason we recommend running flask in a subdirectory is so you can use your account for more than one thing. If you run flask in the web root, then that's all you can do with your whole account.
heirloom Posted August 15, 2020 Author Posted August 15, 2020 (edited) Nice, it's good to know that I can run flask from the web root. That's not what I'm asking though. I want to keep flask in the subdirectory. But the routes of my app don't take into account that subdirectory so I need a way to append '/flask/' to all routes without actually having to change them one by one in the code. Edited August 15, 2020 by heirloom
Krydos Posted August 16, 2020 Posted August 16, 2020 Perhaps try something like this https://stackoverflow.com/a/18967744/2336864
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now