Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Hosting a Django app with Caddy and PostgreSQL

From Nest Guides
Revision as of 14:47, 15 July 2025 by Twonum (talk | contribs) (Created page with "THIS IS A WIP! This (unofficial) guide was made by [@twonum https://hackclub.slack.com/team/U094NTBR1S5] (feel free to ask me for help). I'm using Hypercorn as it's an ASGI server (for WebSockets support). To use a different server, replace the <code>hypercorn</code> commands with the ones that your server uses. ; Tools this guide uses * Hypercorn ASGI server * Caddy reverse proxy and web server with automatic HTTPS * PostgreSQL relational database for Django's ORM *...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

THIS IS A WIP!

This (unofficial) guide was made by [@twonum https://hackclub.slack.com/team/U094NTBR1S5] (feel free to ask me for help).

I'm using Hypercorn as it's an ASGI server (for WebSockets support). To use a different server, replace the hypercorn commands with the ones that your server uses.

Tools this guide uses
  • Hypercorn ASGI server
  • Caddy reverse proxy and web server with automatic HTTPS
  • PostgreSQL relational database for Django's ORM
  • systemd "daemon" (as it's called in Unix) to manage services


I'll assume that orpheus is your username and this is your directory structure:

  • ~ (/home/orpheus)
    • project
      • manage.py
      • ...
    • static
      • project
        • static
        • media
    • Caddyfile
    • .config
    • ...

Getting ready

First, get a shell to Nest. Don't have a Nest account?

ssh orpheus@hackclub.app

Get Nest resources

ssh orpheus@hackclub.app
export PROJECT_NAME="your project directory name" # set this to your project's directory name (like "project" in <code>/home/$USERNAME/project</code>)

hackclub.app or custom domain?

$PROJECT_NAME.$USERNAME.hackclub.app (free)

export PROJECT_DOMAIN=$PROJECT_NAME.$USERNAME.hackclub.app
nest caddy add $PROJECT_DOMAIN

Custom domain (looks better, but you need your own DNS)

Add a CNAME record to $USERNAME.hackclub.app

export PROJECT_DOMAIN="hello.example.com" # set this

Get your project on Nest

Copy the directory containing manage.py to /home/$USERNAME/$PROJECT_NAME. See Quickstart#Using_the_Account.

cd ~/$PROJECT_NAME