Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 1.33 KB

README.md

File metadata and controls

27 lines (19 loc) · 1.33 KB

Django with Uvicorn deployed from uv on Clever Cloud

You'll need a Clever Cloud account and Clever Tools to deploy this application, using our Python image now including uv.

Clone this repository and configure a Clever Cloud application

git clone https://github.com/CleverCloud/python-django-uv-example.git
cd python-django-uv-example

clever create -t python
clever env set CC_RUN_COMMAND "uv run -- uvicorn --host 0.0.0.0 --port 9000 myDjango.asgi:application"
clever deploy && clever open

How this app was created

To create the same app as this one on a machine with uv installed, you can use the following commands:

uv init myDjango --no-readme                    # Create a new uv project
cd myDjango && rm hello.py                      # Enters the project and clean it
uv add django uvicorn                           # Adds Django and Uvicorn to dependencies
uv run django-admin startproject myDjango .     # Creates the Django project in the current directory

Edit myDjango/settings.py to add ALLOWED_HOSTS (* in this example), change secret key, etc. Commit changes to the local git repository, and then you can create and deploy this app on Clever Cloud as mentioned above.