Skip to content

oboynitro/django_inertia_vue_scaffold

Repository files navigation

Django + Inertia + Vue with Vite scaffold

A basic, Django + Inertia + Vue with Vite

Technologies

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

How to install & run

  1. Download the repo. You can either:

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

    git clone https://github.com/oboynitro/django_inertia_vue_scaffold.git
  2. Install required Python packages.

    # Create and activate a virtual environment
    # linux and mac
    virtualenv venv
    source .venv/bin/activate
    
    #windows users
    ./venv/Scripts/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