91 lines
2.6 KiB
Markdown
91 lines
2.6 KiB
Markdown
# Django Tutorials - Modern Stack (2026 Edition)
|
|
|
|
This project has been modernized to run on **Django 6.0** with a **React 18.x** frontend powered by **Vite**.
|
|
|
|
## Tech Stack
|
|
|
|
- **Backend**: Django 6.x (LTS), Python 3.14+, Django Ninja (API), `uv` (Package Manager), Pydantic Settings, Ruff.
|
|
- **Frontend**: React 18.x, Vite (Build Tool), TanStack Query (Data Fetching), DaisyUI (CSS), ESLint + Prettier.
|
|
- **Automation**: Unified `Makefile` for one-command development.
|
|
|
|
---
|
|
|
|
## 🚀 Getting Started (New Developers)
|
|
|
|
Follow these steps to set up your local development environment:
|
|
|
|
### 1. Prerequisite: Install `uv`
|
|
|
|
This project uses `uv` for lightning-fast Python dependency management.
|
|
On macOS, use:
|
|
|
|
```sh
|
|
brew install uv
|
|
```
|
|
|
|
On Linux, follow the instructions for your distribution's package manager.
|
|
|
|
### 2. Configure Environment
|
|
|
|
The project uses a strict configuration schema.
|
|
You **must** create a local `.env` file in the project root or the server will refuse to start:
|
|
|
|
```sh
|
|
cp .env.example .env
|
|
```
|
|
|
|
To generate a secure secret key for your `.env` file, run:
|
|
```sh
|
|
make secret-key
|
|
```
|
|
|
|
*Note: The `.env` file is ignored by git to keep your local secrets safe.*
|
|
|
|
### 3. Install Dependencies
|
|
|
|
Install both Python (via `uv`) and Node.js (via `npm`) packages:
|
|
|
|
```sh
|
|
make install
|
|
```
|
|
|
|
### 4. Initialize Database
|
|
|
|
Create your local SQLite database and run the initial migrations:
|
|
|
|
```sh
|
|
make migrate
|
|
```
|
|
|
|
### 5. Start Development Servers
|
|
|
|
Run both the Django backend (port 8000) and Vite frontend (port 3000) in parallel:
|
|
|
|
```sh
|
|
make run
|
|
```
|
|
|
|
---
|
|
|
|
## 🛠 Available Commands
|
|
|
|
To see the most up-to-date list of commands, simply run `make help`.
|
|
|
|
| Command | Description |
|
|
|:----------------|:-------------------------------------------------------|
|
|
| `make build` | Build the React frontend for production. |
|
|
| `make clean` | Remove build artifacts, node_modules, and cache. |
|
|
| `make install` | Install all backend and frontend dependencies. |
|
|
| `make lint` | Run all formatters and code quality checks. |
|
|
| `make migrate` | Run Django database migrations. |
|
|
| `make run` | Start both dev servers in parallel. |
|
|
| `make secret-key` | Generate a random Django secret key. |
|
|
| `make settings` | Show differences between current and default settings. |
|
|
| `make test` | Run all backend (Django) and frontend (Vitest) tests. |
|
|
|
|
---
|
|
|
|
## 📡 API Documentation
|
|
|
|
When the server is running, you can access the automatic **Swagger UI** for the Django Ninja API at:
|
|
👉 [http://127.0.0.1:8000/api/docs](http://127.0.0.1:8000/api/docs)
|