dhythm / django-inertia-react-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Django + Inertia + React

Create environment

Set up Django

poetry init
poetry add Django@4
django-admin startproject backend .
poetry run python manage.py runserver 8080

Set up React + Vite

npm create vite@latest frontend

✔ Select a framework: › React
✔ Select a variant: › TypeScript + SWC

Scaffolding project in /Users/yuta.okada/local/django-inertia-react-example/frontend...

Done. Now run:

  cd frontend
  npm install
  npm run dev

Install adapter for Django

poetry add inertia-django django-vite

Install libs for React

npm install -D @types/node
npm install -D @inertiajs/react

Run App

Run the following command in the root dir.

poetry run python manage.py runserver 8080

Run the following command in the frontend dir.

cd frontend
npm run dev

Then, access to http://localhost:8080

References

About


Languages

Language:Python 52.2%Language:TypeScript 22.6%Language:CSS 14.7%Language:HTML 6.8%Language:JavaScript 3.6%