Deploy
Django
This guide walks you through deploying a Django application on Takk. Django is a batteries-included web framework for Python. While Takk doesn't have a dedicated Django app type, you can deploy Django using the NetworkApp configuration, which gives you full control over the startup command and port.
Prerequisites
Make sure you have the Takk CLI installed and are logged in. If not, follow the Get Started guide first.
Create the Project
Start by creating a new directory and initializing it:
mkdir django-hello
cd django-hello
uv init
Add your dependencies:
uv add django gunicorn takk
Create the Django App
Use the Django CLI to scaffold a new project:
uv run django-admin startproject hello .
Then create a simple view. Edit hello/views.py:
from django.http import JsonResponse
def index(request):
return JsonResponse({"message": "Hello, World!"})
def greet(request, name):
return JsonResponse({"message": f"Hello, {name}!"})
Wire up the URLs in hello/urls.py:
from django.urls import path
from hello.views import index, greet
urlpatterns = [
path("", index),
path("greet/<str:name>/", greet),
]
Update hello/settings.py to allow all hosts (required for containerized deployments):
ALLOWED_HOSTS = ["*"]
Define the Project
Create project.py to tell Takk how to run Django:
from takk.models import Project, NetworkApp
project = Project(
name="django-hello",
server=NetworkApp(
command=["gunicorn", "hello.wsgi:application", "--bind", "0.0.0.0:8000"],
port=8000,
),
)
The NetworkApp lets you specify any startup command and port. Here we use Gunicorn to serve the Django application, which is the recommended production setup.
Run Locally
Start the local development environment:
uv run takk up
Your Django app is now running at http://localhost:8000. Test it:
curl http://localhost:8000
# {"message": "Hello, World!"}
curl http://localhost:8000/greet/Alice/
# {"message": "Hello, Alice!"}
Deploy
Deploy to the cloud with:
uv run takk deploy
Takk builds the container, provisions infrastructure, and starts your Django application. TLS and networking are handled automatically.
Next Steps
Add a custom domain to your project
Configure secrets for
SECRET_KEYand database credentialsSet up database revisions for Django migrations
Learn more about NetworkApp configuration options

