From a4ef784946330abc6aed8e03accdf7541881df0f Mon Sep 17 00:00:00 2001 From: mjfernez Date: Mon, 7 Jun 2021 19:47:59 -0400 Subject: wsgi compatibility Moves the setup() function outside of main so the app is setup before a wrapper runs it. Also fixes deployment tutorial in the README --- README | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'README') diff --git a/README b/README index d723a5c..5ebe3c9 100644 --- a/README +++ b/README @@ -44,7 +44,7 @@ zip), change into the directory, then: `python server.py` -Your server will (by default) be hosted on http://localhost:8000 +Your server will (by default) be hosted on http://127.0.0.1:5000 ## Adding Pages @@ -165,14 +165,16 @@ You can disable it by deleting the code under `send_file_from_site` or You should NOT run this server as in the quick start, but instead deploy it in an appropriate container. Refer to https://flask.palletsprojects.com/en/2.0.x/deploying/ -for options, but an easy option I like is to use uswgi. On a Debian-like distro +for options, but an easy option I like is to use uwsgi since it's well +documented. -`sudo apt install uwsgi` `python -m venv env` -`uwsgi -s /tmp/yourapplication.sock --manage-script-name --mount /yourapplication=server:app` +`pip install uwsgi` +`doas -u www uwsgi -s /var/path/to/your-flask.sock --manage-script-name --mount /=server:app --virtualenv ./env` Then point your main http daemon (niginx, apache, httpd) to the socket you -made. See nginx as an example here, more in the same doc: +made. There are examples for a nginx configuration in the uWSGI and Flask docs: -https://uwsgi-docs.readthedocs.io/en/latest/Nginx.html +- https://uwsgi-docs.readthedocs.io/en/latest/Nginx.html +- https://flask.palletsprojects.com/en/2.0.x/deploying/uwsgi/ -- cgit v1.2.3