Skip to content

mujahidfa/inertia-django-vite-vue-minimal

Repository files navigation

Inertia + Django + Vite + Vue minimal template

A minimal, working template for Inertia + Django + Vite + Vue.

Technologies

  1. Inertia - powered by the official Inertia.js Django Adapter
  2. Django v4.2
  3. Vite 5 - powered by Django Vite
  4. Vue 3
  5. TypeScript
  6. WhiteNoise - to serve static files

How to install & run

  1. Download the repo. You can either:

    a. Clone the repo (without the git history):

    npx degit https://github.com/mujahidfa/inertia-django-vite-vue-minimal

    b. Or, create a repo based on this template via the GitHub template generator.

  2. Install required Python packages.

    # Create and activate a virtual environment
    python3 -m venv .venv
    source .venv/bin/activate
    
    # Install required Python packages
    pip install -r requirements.txt
  3. Install required Node.js packages.

    npm install
  4. Run the Vite dev server:

    npm run dev
  5. Run Django's default migrations:

    python manage.py migrate
  6. Run the Django dev server (in a separate terminal):

    python manage.py runserver

How to build for production

  1. Set DEBUG=False in settings.py.

    # In settings.py
    ...
    DEBUG=False
    ...
  2. Build the JS/assets for production:

    npm run build
  3. Run collectstatic:

    rm -rf staticfiles/
    python manage.py collectstatic
  4. Run the Django server:

    python manage.py runserver