A Django boilerplate made with Modernity in mind.
Django 4.0.x
- a web framework written in Python; you also will write apps in Python.Tailwind.css
- a CSS utility framework that allows frontend customizations with HTML classes; and builds what-you-only-need on production.htmx
- a supercharger for websites that came in HTML utility tags, make AJAX requests, capture many events and replace HTML content without actually writing JS.
Python >= 3.8
Node.js >= 16 + npm
Postgres Server + Client Library ~= 14
see docs for more info
gcc
or any C compilerPython headers
usually inpython3-dev
packagelibpq-dev
To setup this boilerplate with the most stable version, head to the Releases tab and get the latest one.
- Setup your
.env
file to store enviroment variables. Please refer to.env.example
- Make sure to put the absolute path of
npm
forNPM_BIN_PATH
!
- Make sure to put the absolute path of
- Create a new Python virtual environment inside the directory,
python3 -m venv .venv # or on Windows... python -m venv .venv
- Source or activate your virtual environment.
- Install Python dependencies,
pip install -r requirements.txt # or if you're installing for production... pip install -r requirements/prod.txt
- Navigate to
./theme/static_src/
. - Install Node packages required,
npm install
- Navigate back to the root of directory.
- Run the server to test setup, you will need to run two servers (concurrent),
python3 ./manage.py tailwind start # runs Tailwind.css server python3 ./manage.py runserver # runs Django server
After completing the setup you can consult the materials to get started on developing a supercharged Django app!
Added in Revision 3
Type checking is a powerful tool for developers to know what they're doing. In Django, types are pretty much
generic especially, RelatedManager
, ForeignKey
etc.
To solve the problem of most type checker not being able to understand Django's typing, we must use an extension to the source code, "stubs."
This boilerplate uses django-types
package from PyPI as stubs and it needs some workarounds to work properly.
Consult the Github Repository for more info.
Don’t keep "trying" solutions until you find one that works. Take the time to find the correct solution. -- Steve Maguire
There are also materials for specific Python packages for app dependencies,
- If you're ready to step up your game and use some satisfying functions from
django.contrib.postgres
, setLOCAL_DB
to "False"
Note: you'll lose support for other database providers but, the application will be much more easier to be used with Postgres.