Django + Postgres API

A Django 5.2 REST API with a notes resource, token auth for writes and the Django admin, on a managed Postgres database. Click Deploy and Naijacloud builds it from the public repo, creates the Postgres database and connects it, runs the migrations and gives you a live HTTPS address. No GitHub connection needed.

DjangoPostgres

What's inside

  • Django 5.2 and Django REST Framework, with a notes resource at /api/notes/
  • Token auth for writes (reads are public), and the Django admin at /admin/
  • Postgres through DATABASE_URL, static files through WhiteNoise, served by gunicorn
  • Migrations and collectstatic run before gunicorn starts, on every deploy

What you get after deploying

  • A live address at https://django-postgres-api.naijacloud.app with HTTPS
  • A Postgres database, with DATABASE_URL already set on the service
  • Build and runtime logs, metrics and redeploys from the dashboard

Environment variables

You can change any of these on the deploy screen.

DATABASE_URLPostgres connectionSet by Naijacloud
DJANGO_SECRET_KEYSigns sessions and tokensGenerated on deploy
DJANGO_ALLOWED_HOSTSHosts Django will answer.naijacloud.app,localhost,127.0.0.1
DJANGO_DEBUGDebug pagesFalse

Run it locally

$ git clone https://github.com/naijacloud/template-django-postgres-api
$ cd template-django-postgres-api
$ python -m venv .venv && source .venv/bin/activate
$ pip install -r requirements.txt
$ export DJANGO_DEBUG=True
$ python manage.py migrate
$ python manage.py runserver
Learn how it worksConnecting to a database

Whatever you build it with, it ships here.

Deploy your app for free

Free tier forever · No card