Starter setup best practice Django:
apps/all apps django start hereconfig/settings/switch:base,dev,staging,prod- move env just edit in .env
DJANGO_ENV=dev|staging|prod - frontend integration with
django-tailwind,alpinejs
.
├── manage.py
├── shell.nix
├── apps/
├── theme/
├── static/
└── config/
└── settings/
├── __init__.py
├── base.py
├── dev.py
├── staging.py
└── prod.py
Rename env.example to .env
DJANGO_ENV=prod/dev/stagingpython manage.py startapp yournewapps apps/yournewappsor simply in nixos:
nix-shellNote:
nix-shellautomatically creates a Python virtual environment in thevenvfolder and activates it.
Then:
startapp <appname> # python manage.py startapp <appname> apps/<appname>
tw-install # python manage.py tailwind install
tw-watch # python manage.py tailwind start
run # python manage.py runserver 0.0.0.0:8000sign up yournewapps in: LOCAL_APPS ( config/settings/base.py):
LOCAL_APPS = [
"apps.yournewapps"
]Update file apps in: apps.yournewapps.app.py
name = 'yournewapps'To:
name = 'apps.yournewapps'Install:
pip install -r requirements.txttailwindcss apps in
THIRD_PARTY_APPS = [
"tailwind",
"theme",
]Init + install + run Tailwind:
python manage.py tailwind install
python manage.py tailwind startin templates (ex: templates/base.html):
{% load tailwind_tags %}
{% tailwind_css %}python manage.py runserver