start-django Docs
start-django.fly.dev ^3.11
4.2
+ fly.io
personal boilerplate, ft.:
- UI from django-fragments attempting locality-of-behavior:
{% icon %}
-<svg>
tag combiner{% themer %}
-<button onclick=toggleTheme()>
enclosing two{% icon %}s
.{% hput %}
- TailwindCSS + widget-tweakable<input>
{% sel %}
- hyperscript w/ aria-*<select>
{% include '_msg.html' ... %}
- -htmx messages
- Deployable fly.toml based on compose.yml
services
:web
: toggle settings: dev | test | proddb
: sqlite default, postgres-configurableworker
: huey background tasksredis
: message broker
- Connected Custom User Model:
- django-allauth logic where UI templates have been styled.
- python-postmark transactional emails (e.g. confirm auth, change password, etc.)
- 1-to-1 Profile with
ImageField
(custom storage class to host/serve Cloudflare Images) - foreign key
UserConsent
model for Terms of Use.
poetry, npm, vscode, just, ^3.11 python
# 'just' wraps initial setup into a single command
gh repo clone justmars/start-django dj \
&& cd dj \
&& just start # (1)
- When copy/pasting, just change
dj
to whatever folder. See to unpack steps in this recipe which includes virtual environment (.venv
) setup viapoetry
; installation of tailwind withnpm
and running the build step withnpx tailwindcss
; and initial management commands:collectstatic
,compress
,makemigrations
,migrate
andrunserver_plus
(fromdjango_extensions
).
- Set example file to .env to make it easy to supply env vars.
- This will create
/nodemodules/
(.gitignore
ed) containing TailwindCSS dependencies. - Invokes
/src/static/css/input.css
+./tailwind.config.js
to build/static/css/output.css
. See full process - Installs virtual environment in a local
.venv
(assumespoetry config --list
showsvirtualenvs.create = true
andvirtualenvs.in-project = true
) then createspoetry.lock
, ensures a copy of the requirements.txt file is copied into/src
- Prepares models declared in
src/pages
and/src/profiles
as sql statements found in/migrations
folder of each app. Since I didn't declare aDATABASE_URL
in the environment, this will default to creating an emptysrc/db.sqlite
- Sets up tables in default sqlite database (unless a
DATABASE_URL
pointing to a local postgres db is set in.env
) - Populates
/src/staticfiles
directory - Creates compressed css / js manifest in
/src/static/CACHE
- Django management command to launch django.setup(). No need to setup
.env
values since default local settings will be used as a quickstart example. Uses django_extention's runserver_plus
Details
After initial setup: