/ programming

Flask get server host

How to get Flask server host address?
The flask python app host can be accessed (during a request) by running:
flask.request.host
# Or the full url:
flask.request.host_url

For more info read about app_context on the official Flask docs.