Skip to content

Instantly share code, notes, and snippets.

Last active November 3, 2022 21:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cellularmitosis/ca7837ccac8264a0bf910fd34f11f298 to your computer and use it in GitHub Desktop.
Flask "Hello, world!" using mod_wsgi-express

Blog 2020/5/8

<- previous | index | next ->

Flask "Hello, world!" using mod_wsgi-express

For locally developing a Flask application, using mod_wsgi-express instead of apache is a much quicker way to get started.

Simply run mod_wsgi-express start-server hello.wsgi, then visit http://localhost:8000 (or, you can just run make).

$ mod_wsgi-express start-server hello.wsgi
Server URL         : http://localhost:8000/
Server Root        : /var/tmp/mod_wsgi-localhost:8000:501
Server Conf        : /var/tmp/mod_wsgi-localhost:8000:501/httpd.conf
Error Log File     : /var/tmp/mod_wsgi-localhost:8000:501/error_log (warn)
Request Capacity   : 5 (1 process * 5 threads)
Request Timeout    : 60 (seconds)
Startup Timeout    : 15 (seconds)
Queue Backlog      : 100 (connections)
Queue Timeout      : 45 (seconds)
Server Capacity    : 20 (event/worker), 20 (prefork)
Server Backlog     : 500 (connections)
Locale Setting     : en_US.UTF-8

In another terminal, tail the error log:

tail -f /var/tmp/mod_wsgi-localhost:8000:501/error_log

When done, simply hit control+c to stop the server.

from flask import Flask
app = Flask(__name__)
def hello_world():
return 'Hello, world!'
from hello import app as application
mod_wsgi-express start-server hello.wsgi
brew install python
pip3 install flask mod_wsgi
.PHONY: run deps-mac
Copy link

cool super ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment