Squadbase logo

Django

Learn how to leverage Squadbase's features with Django.

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of web development, so you can focus on writing your app without needing to reinvent the wheel.

Squadbase provides comprehensive support for Django applications with the following features:

  • Automated deployment from GitHub repositories to cloud environments
  • Built-in authentication and security features
  • Log monitoring

Resources

Get started with these essential Django resources:

Creating a New Django Application

This guide shows you how to create a Django application using uv, our recommended package manager for Python projects.

Start by initializing your project and installing the necessary dependencies:

Terminal
uv init my-django-app
cd my-django-app
Terminal
uv add django gunicorn

Now create your Django project:

Terminal
uv run django-admin startproject myproject .

Create a simple view to test your application:

myproject/views.py
from django.http import JsonResponse

def home(request):
    return JsonResponse({
        "message": "Hello from Django on Squadbase!",
        "status": "success"
    })

Update your URL configuration:

myproject/urls.py
from django.contrib import admin
from django.urls import path
from . import views

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', views.home, name='home'),
]

Launch your Django application for development:

Terminal
uv run python manage.py runserver

Your Django application is now ready for development! 🎉

Test your application to ensure everything is working:

Terminal
curl http://127.0.0.1:8000/

For comprehensive Django documentation and tutorials, visit the Django Official Documentation.

Deploying with GitHub Integration

Setting up squadbase.yml

Create a squadbase.yml configuration file in your project root. For a typical Django project with manage.py and pyproject.toml, your file structure should look like this:

manage.py
pyproject.toml
squadbase.yml

Here's a minimal squadbase.yml configuration:

squadbase.yml
# squadbase.yml
version: '1'

build:
  framework: django
  runtime: python3.11  # Supported: python3.9, python3.10, python3.11, python3.12, python3.13
  package_manager: uv # Supported: pip, poetry, uv
  entrypoint: myproject.asgi:application

For advanced configuration options, see our squadbase.yml reference.

If you need to customize your deployment environment (e.g., install system packages for database drivers) or want to inspect the generated Dockerfile, check out our Docker framework guide.

Connecting Your GitHub Repository

Import your GitHub repository through the Squadbase dashboard. Deployment will begin automatically once the import process completes.

Continuous Deployment

Make changes to your application and push them to your GitHub repository. Squadbase will automatically detect the changes and deploy the new version.

Monitoring and Logs

Squadbase provides comprehensive log monitoring for your deployed applications. You can view logs for each deployment and track application performance across different versions.

Log Monitoring