Gist fd6e7c4e3cd0a8af8e9d
✓ Published0🌍 Public
Aachanda101
Last edited Dec 20, 2012
Created on May 18, 2015
This example demonstrates how to serve a Django web application through CherryPy, automatically opening a browser at localhost:8001 after a short delay. The `serve.py` script configures CherryPy’s WSGI handler to graft the Django `WSGIHandler`, mounts static files from Django’s `STATIC_ROOT` at `STATIC_URL`, and sets server options like socket host, port, and autoreload off. It uses `Timer` from Python’s `threading` module to trigger the browser launch, making the visualization immediately viewable. The code relies on Django’s settings and static-file handling, with CherryPy managing the HTTP server lifecycle.
AI-generated description