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 pref
Disclaimer: This code is not tested. I am just giving you a ballpark idea of how to approach this.
I suggest you use blueprints in combination with an extension like Flask-Babel. For example, you can do something like:
views.pymysitebp = Blueprint('mysitebp',__name__)
Then in your application package (usually __init__.py) , you can do:
__init__.pyfrom mysite.views import mysitebp
app = Flask(__name__)
app.register_blueprint(mysitebp,url_prefix='/en/',template_folder='en')
app.register_blueprint(mysitebp,url_prefix='/fr',template_folder='fr')
..and so on
Your directory structure could look like:
mysite/
__init__.py
views.py
templates/
base.html
404.html
en/
en.html
fr/
french.html
Flask-Babel would help you translate the 404.html etc.