I have one server with flask application instance and have several domain which mapped to this server by DNS.
My site must support several languages by host and prefix:
mysite.com - english
mysite.com/fr - franch
mysite.ru - russian
mysite.ru/by - belarusian
localhost or other unknown host without language prefix - default language (english)
I implemented it with double route registration /endpoint
and /<lang>/endpoint
and reloaded url_for
function and it work, but now I must implement custom error pages for abort
function:
mysite.com/wrong-url-there - mysite.com/404.html (english)
mysite.com/fr/wrong-url-there - mysite.com/fr/404.html (franch)
mysite.ru/wrong-url-there - mysite.ru/404.html (russian)
mysite.ru/by/wrong-url-there - mysite.ru/by/404.html (belorusian)
And I don't see solution for this.
I think my implementation bad and I must improve it. I think I must create one instance of application for each site language root with predefined language for it or use blueprint, but I don't find solution for me yet.
Is anybody can give me advice how resolve this url multilanguages support with flask or wsgi or nginx?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…