Skip to content

Instantly share code, notes, and snippets.

@NanoDano
Created August 3, 2020 03:45
Show Gist options
  • Save NanoDano/a5b10478a52bfaeaaa1ae4835f403441 to your computer and use it in GitHub Desktop.
Save NanoDano/a5b10478a52bfaeaaa1ae4835f403441 to your computer and use it in GitHub Desktop.
Run a Python WSGI app with Waitress
# pip install waitress
import os
from waitress import serve
from my_wsgi_project import app # Import your app
# Run from the same directory as this script
this_files_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(this_files_dir)
# `url_prefix` is optional, but useful if you are serving app on a sub-dir
# behind a reverse-proxy.
serve(app, host='127.0.0.1', port=8001, url_prefix='/my-app')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment