Hello Stackoverflow'ers
Have a routing problem with flask and the local apache server I have set up and none of the solutions I've found on the net works. I'm stuck on how to solve it and asks the question here.
On apache I have the following setup:
WSGIScriptAlias /programmet /path/to/where/script/is/located/script.wsgi
and have set up the local address for the server to be: server.x
I'll make two examples of what I have made in flask:
program = Flask(__name__, template_folder="html")
@program.route("/")
def start():
return render_template("index.html")
@program.route("/log-in")
def login():
return render_template("login.html")
Upon writing server.x/programmet/, the scripts starts and works but the routes doesn't work att all when clicking on the links made in the html file.
What I see is that the routes are linking to the server root not the script root. IE when clicking on the following links:
<"a href="/"">"Start"<"/a">
<"a href="/log-in"">"Log in"<"/a">
It doesn't go to server.x/programmet/
or server.x/programmet/log-in
. Instead the routing tries to connect to the following adresses: server.x
and server.x/log-in
.
How can I solve the problem and get the correct routes in Flask?
EDIT
Have to do an edit on the original post based on the excellent tips furas gave me.
The tips he gave me didn't work for a start BUT this was when running the apache server.
I downloaded the gunicorn server and tried the script there. It worked like a charm. All links through Flask was linked correctly.
Obviously there is something wrong on the server side (that will say the apache server). So is it anybody that knows how to fix the issue with the apache?