Skip to main content

Django + SQLite

Pre-requisites

Set up

  • If you haven't yet connected your GitHub account with your disco installation, run:
disco github:apps:add

You only need to do this once.

Steps

  • Create an CNAME record for your project and point it to your disco server's address
    • let's say that your disco server's address is disco.example.com
    • create a CNAME for your project such as blog.example.com (the "from") and point it to the server's disco.example.com address (the "to")
  • Fork the example repo
  • Add the project to your server by running the command below:
disco projects:add \
--name my-django-site \
--github USERNAME/REPONAME \
--domain DOMAINNAME

above, replace:

  • the USERNAME/REPONAME with the path to your GitHub fork (e.g., john/my-project)
  • DOMAINNAME with the domain you wish to deploy your project to

Final steps

We need to run 2 commands so that the deployed project can work. To do so, run:

# generate a secret key, for example using `uuidgen`,
# and set it as the DJANGO_SECRET_KEY value below:
disco env:set --project my-django-site \
DJANGO_SECRET_KEY="... secret value ..." \
DATABASE_URL="sqlite:////sqlitedata/db.sqlite3"
disco run --project my-django-site "python manage.py migrate"

That's it! Your project will now deploy to your server.

Once deployed, go to your domain name. Your site should be there!