Jump to content

[Solved] [Flask] /path is becoming /flask.wsgi/path


rik61072

Recommended Posts

I followed the tutorial of getting a flask app running on Heliohost. I changed the .htaccess file a bit so that public_html folder can be the source of my flask app rather than rikchan.heliohost.org/flask (that is my site btw).

 

So all the links like rikchan.heliohost.org/meta is getting redirected to rikchan.heliohost.org/flask.wsgi/meta , which is also working but I would like my flask app to behave how it was intended to be.

 

here is the website link https://rikchan.heliohost.org

Link to comment
Share on other sites

Hi rik,

 

I had a similar issue a while back and have I just found the solution 20 mins from the time of this post (I can be very persistent when it comes to problem solving)

 

just add this at the top of your app.py file 

class ScriptNameStripper(Flask):
    def __call__(self, environ, start_response):
        environ['SCRIPT_NAME'] = ''
        return (super(ScriptNameStripper, self)
                .__call__(environ, start_response))
                
app = ScriptNameStripper(__name__) 

you'll have to replace app = Flask(__name__) with app = ScriptNameStripper(__name__)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...