This is a blog template built with React (Vite) and Django REST Framework.
| Component | Technology | Directory | Version |
|---|---|---|---|
| Frontend | React + Vite | /blogapp1 | 18.3.1 |
| Backend | Django | /blogApi | 5.1.6 |
| API | Django REST Framework | 3.15.2 |
- Navigate to the parent blogApi directory:
cd blogApi- Create virtual environment:
python -m venv .venv- Activate virtual environment:
Windows:
.venv\Scripts\activateUnix/macOS:
source .venv/bin/activate- Create and configure environment variables:
# Windows
copy .env.example .env
# Unix/macOS
cp .env.example .env- Install dependencies:
pip install -r requirements.txt- Run migrations:
python manage.py migrate- Create a superuser (admin account):
python manage.py createsuperuser- Collect static files:
python manage.py collectstatic- Start the development server:
python manage.py runserver 8003NOTE: Run the Django Backend Server Port on 8003 to ensure the frontend can connect to the backend API.
The backend API will be available at http://localhost:8003
The admin interface will be available at http://localhost:8003/admin
- Navigate to the blogapp1 directory:
cd blogapp1- Install dependencies:
npm install- Start the development server:
npm run devThe frontend will be available at http://localhost:5173
While still with your virtual environment activated, To load the initial data into your database:
python manage.py loaddata blogApp/fixtures/initial_data.jsonTo update the fixture file with new data:
python manage.py dumpdata blogApp --indent 4 > blogApp/fixtures/initial_data.json