Description
Problem
Stems from #2566
runserver
does not support critical features we will need after converting the app to ASGI:
- Actually running the ASGI app in full asynchrony
- Multiple workers (to test production configuration)
We're also making the configuration slightly more complex by moving to ASGI, relying on gunicorn and uvicorn workers.
Description
To anticipate these complexities and make the local development environment (a) behave more like production and (b) require fewer changes when switching to full ASGI, swap out manage.py runserver
for gunicorn --reload
. Once we switch to ASGI in #2790, we'll either continue using gunicorn for development (with multiple workers) or can switch to uvicorn --reload
.
runserver
handles static file serving locally, while gunicorn
and uvicorn
won't know what to do. In production we rely on nginx to handle this. We could set up Nginx locally to front the API service, but to keep this simple, it's easier to conditionally add the static route handler that runserver
uses to the API's urls configuration. See these changes as an example (which require supporting changes for the ENVIRONMENT
variable and changes to the static file configuration generally, all present in that commit).
Additional context
Something along these lines will be necessary for ASGI conversion anyway. Doing this as a separate issue again reduces
Metadata
Assignees
Labels
Type
Projects
Status
✅ Done