librelist archives

« back to archive

url_for and SERVER_NAMEissues

url_for and SERVER_NAMEissues

Thibaut Colar
2013-06-05 @ 06:48
I have a flask app that needs to do some redirects (oauth), I'm using
url_for to generate  urls, on my local machine all is well. Note: I do use

The I push it on the live server, say "", it does not work
properly because url_for is generating some local url (http://localhost....)
even if I use _external = True

I figured the fix is to define SERVER_NAME= ""
However when I do that I cannot seem to access the app at all and I'm not
sure why, I tried to make sure resolved to but
even then I get 404's for everything unless i remove SERVER_NAME.

I'm guessing flask only "listens" to a specific domain when SERVER_NAME is
set .... any tips on getting this worked out .... I could hard code the
redirect url's and not use SERVER_NAME I suppose but being able to use
url_for would be nicer.