Switch local API dev server to use gunicorn --reload
instead of Django's runserver
#2814
Labels
💻 aspect: code
Concerns the software code in the repository
🧰 goal: internal improvement
Improvement that benefits maintainers, not users
🟧 priority: high
Stalls work on the project or its dependents
🧱 stack: api
Related to the Django API
Milestone
Problem
Stems from #2566
runserver
does not support critical features we will need after converting the app to ASGI: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
forgunicorn --reload
. Once we switch to ASGI in #2790, we'll either continue using gunicorn for development (with multiple workers) or can switch touvicorn --reload
.runserver
handles static file serving locally, whilegunicorn
anduvicorn
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 thatrunserver
uses to the API's urls configuration. See these changes as an example (which require supporting changes for theENVIRONMENT
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
The text was updated successfully, but these errors were encountered: