Skip to content
/ dirt-stack-template Public template

a simple template for django + inertia + react + tailwind.

Notifications You must be signed in to change notification settings

linyers/dirt-stack-template

Repository files navigation

D.I.R.T. template

A template for Django that uses Inertiajs, React with TypeScript, and TailwindCSS.

How to use

Setup

  1. 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
  2. Install the python dependencies

    pip install django inertia-django django-vite whitenoise
  3. Run

    django-admin startproject --template https://github.com/linyers/dirt-stack-template/archive/master.zip my_django_project .
  4. Install node dependencies

    pnpm i

Development

  1. Run the Django's migrations

    ./manage.py migrate
  2. Run D.I.R.T. Vite's dev server

    pnpm run dev
  3. Run the Django dev server (in other terminal)

    ./manage.py runserver

Production

  1. Set DEBUG=False in Django's project settings

    # In settings.py
    ...
    DEBUG=False
    ...
  2. Build Js/assets for production

    pnpm run build
  3. Run the Django's migrations

    ./manage.py migrate
  4. Run collectstatic

    rm -rf staticfiles/
    ./manage.py collectstatic
  5. 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

Acknowledgments

About

a simple template for django + inertia + react + tailwind.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published