A template for Django that uses Inertiajs, React with TypeScript, and TailwindCSS.
-
Setup some virtual enviroment (virtualenv, poetry, etc) and activate them
virtualenv venv # or python -m venv venv # linux and mac source venv/bin/activate #windows users ./venv/Scripts/activate
-
Install the python dependencies
pip install django inertia-django django-vite whitenoise
-
Run
django-admin startproject --template https://github.com/linyers/dirt-stack-template/archive/master.zip my_django_project .
-
Install node dependencies
pnpm i
-
Run the Django's migrations
./manage.py migrate
-
Run D.I.R.T. Vite's dev server
pnpm run dev
-
Run the Django dev server (in other terminal)
./manage.py runserver
-
Set
DEBUG=False
in Django's project settings# In settings.py ... DEBUG=False ...
-
Build Js/assets for production
pnpm run build
-
Run the Django's migrations
./manage.py migrate
-
Run
collectstatic
rm -rf staticfiles/ ./manage.py collectstatic
-
Run the Django production server
a. Run the simple WSGI Django's server
./manage.py runserver
b. Or install a WSGI server of your preference and run it, for example, Gunicorn
pip install gunicorn # run the server gunicorn --env DJANGO_SETTINGS_MODULE={{ project_name }}.settings {{ project_name }}.wsgi:application --bind 0.0.0.0:8000