This project is a blog application with a frontend built using React/Next.js and a backend built with Django (using MySQL database).
The project is organized into two main folders:
client
: Contains the React/Next.js frontend application.server
: Contains the Django backend application.
- Node.js (version 14.x or later)
-
Navigate to the
client
directory:cd client
-
Install dependencies:
npm install
-
Start server in development mode:
npm run dev
The frontend server will be running on
http://locahost:3000
- Python 3.9 or later
- MySQL database
-
Navigate to the
server
directory:cd server
-
Create and activate a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Configure database:
Update thesettings.py
file with your MySQL (or PostgreSQL) database configuration.# settings.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'your_database_name', 'USER': 'your_database_user', 'PASSWORD': 'your_database_password', 'HOST': 'localhost', 'PORT': '3306', } }
For PostgreSQL it would be:
# settings.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'your_database_name', 'USER': 'your_database_user', 'PASSWORD': 'your_database_password', 'HOST': 'localhost', 'PORT': '3306', } }
-
Run migrations:
python manage.py makemigrations python manage.py migrate
-
Start development server:
python manage.py runserver
The backend server will be running on
http://locahost:8000
API docs on
http://locahost:8000/swagger