Deploy a Django application
Deploy a Django application with uv and Uvicorn
This guide uses the maintained Clever Cloud Django example. Its committed uv.lock file lets the Python runtime install the exact dependency versions with uv.
Prerequisites
- A Clever Cloud account
- Git
- Clever Tools, installed and connected to your account
Clone the example application
Clone the repository and move into its directory:
git clone https://github.com/CleverCloud/python-django-uv-example.git myDjangoApp
cd myDjangoAppCreate and configure the application
Create a Python application:
clever create -t python -a myDjangoAppClever Tools targets your personal organisation by default. To use another organisation, add --org ORGANISATION or -o ORGANISATION when you create or link the application.
You can display your application’s URL or add a custom domain. A custom domain also requires DNS configuration:
clever domain
clever domain add your.website.tldConfigure the command used to start Uvicorn on the port expected by Clever Cloud:
clever env set CC_PYTHON_UV_RUN_COMMAND "uv run uvicorn --host 0.0.0.0 --port 8080 myDjango.asgi:application"Native uv deployment is enabled by the combination of uv.lock and CC_PYTHON_UV_RUN_COMMAND. If you later add a Request Flow middleware, change the command to listen on port 9000.
Deploy the application
Deploy the repository and display the application:
clever deploy
clever openThe example uses SQLite for demonstration purposes. Local application files are not persistent on Clever Cloud, so configure a managed database such as PostgreSQL before storing production data. Django documents the required database settings and drivers.
Deploy an existing Django project
For an existing uv project, commit pyproject.toml and uv.lock, then adapt the module in CC_PYTHON_UV_RUN_COMMAND to your ASGI application. Configure hosts, secrets, static files and databases through environment variables rather than committing production values.
Projects using requirements.txt instead of uv use the legacy Python deployment mode. Set CC_PYTHON_MODULE to the WSGI or ASGI module expected by the selected backend.