This project is a Django-based mini blog application designed to illustrate the implementation of the Services and Repositories design pattern. It features a clear separation of concerns, making the codebase easier to maintain and extend.
You can follow the step by step of the making of the app on my blog: My blog.
You can see the application test here: Testing App.
- Posts and Comments: Users can create, update, and delete blog posts and comments.
- RESTful API: Provides endpoints for interacting with the application programmatically.
- Web Interface: Offers a basic user-friendly interface for managing posts and comments.
- Service Layer: Contains business logic and orchestrates interactions between views and repositories.
- Repository Layer: Encapsulates data access logic, providing a clean API for the service layer.
- Django Admin: Allows administrative management of posts and comments.
The project follows a modular structure, with each app having its own models, views, serializers, services, and repositories.
my_project_blog/
├── apps/
│ ├── comments/
│ │ ├── models.py
│ │ ├── repositories/
│ │ ├── services/
│ │ ├── templates/
│ │ ├── views/
│ ├── posts/
│ │ ├── models.py
│ │ ├── repositories/
│ │ ├── services/
│ │ ├── templates/
│ │ ├── urls/
│ │ ├── views/
├── my_project_blog/
│ ├── settings.py
│ ├── urls.py
│ ├── wsgi.py
├── manage.py
To get started with this project, follow these steps:
- Clone the repository:
git clone https://github.com/MateoRamirezRubio1/mini-blog-rest-api.git
cd my_project_blog
- Set up a virtual environment:
python -m venv venv
source `venv\Scripts\activate` # This is for windows
- Install dependencies:
pip install -r requirements.txt
- Apply migrations:
python manage.py makemigrations
python manage.py migrate
- Create a superuser:
python manage.py createsuperuser
- Run the development server:
python manage.py runserver
- Access the application:
Open your web browser and go tohttp://127.0.0.1:8000/api/posts/
to start creating posts.