Jump to content

Recommended Posts

Posted

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

Posted

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__)

Posted

Hello thanks for the effort but I did the exact same thing (Changing "SCRIPT_NAME" and "APPLICATION_ROOT" to "") , everything is working but the media files arent loading. They only load if i type /flask.wgi/path rather than /path

Posted

Never mind, I fixed the issue. When I looked at the .htaccess file I saw mention of /media which is exactly what my app uses to serve static images and videos. So I changed /media to /nedia and now its working. Weird solution.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...