django-svelte

Django Svelte

A template for Django/Svelte single-page apps

django-svelte

A template for Django/Svelte single-page apps

This gives you JSON Web Token auth and a few extra files to help you deploy with heroku. I've left a few TODOs in the code, so you can set up your own app. You can see what the template looks like here, but I'm not sure why you would want to, because it only lets you log in

Tech stack

Web

Mobile

Backend

Instructions

Set environment variables

  • DATABASE_URL. For example, my local value is postgres://christiandrappi@localhost:5432/django_svelte
  • PYTHONPATH. Point it to the outer backend dir, since our python does not live in the root directory
  • DJANGO_SECRET_KEY. Create one with:
    $ python
    >>> from django.core.management.utils import get_random_secret_key
    >>> get_random_secret_key()
    

Running locally

Backend Django server (port 8000):
$ python backend/manage.py runserver --settings=backend.settings.dev

Frontend Svelte server (port 8080):
$ cd frontend
$ npm run dev

Deploying to Heroku

  • Use the buildpack negativetwelve/heroku-buildpack-subdir:
    $ heroku buildpacks:set https://github.com/negativetwelve/heroku-buildpack-subdir
  • This uses the .buildpacks definition in the app root

Top categories

Loading Svelte Themes