Render: PyblogAPI
PyBlog API is a robust, production-ready backend for a blog application, built with Django and Django REST Framework (DRF). This project provides a comprehensive set of RESTful endpoints to manage blog posts, user authentication, and data persistence. Designed as a decoupled backend, it allows any frontend application (web, mobile, or desktop) to consume its data via API calls.
This project showcases proficiency in building a complete RESTful API, secure user authentication, data serialization, and professional deployment to a cloud platform like Render.
- User Authentication: Secure user registration, login, and token generation.
- Post Management (CRUD): Full Create, Read, Update, and Delete functionality for blog posts.
- Authorization: Ensures users can only modify or delete their own posts.
- Image Uploads: Handles and serves images associated with blog posts.
- Backend: Python, Django, Django REST Framework (DRF), Gunicorn, PostgreSQL
- Deployment & Tools: Render, dj-database-url, WhiteNoise, Git
All endpoints are designed to be intuitive and easy to use.
Endpoint | Method | Description |
---|---|---|
/register_user/ |
POST |
Registers a new user. |
/token/ |
POST |
Exchanges user credentials for a new access and refresh token. |
/refresh_token/ |
POST |
Refreshes the access token using a valid refresh token. |
/create_blog/ |
POST |
Creates a new blog post. Requires user authentication. |
/update_user_profile/ |
PUT |
Updates the profile of the authenticated user. |
/blogs_list/ |
GET |
Retrieves a list of all published blog posts. |
/user_blogs_list/ |
GET |
Retrieves a list of blog posts for the authenticated user. |
/update_blog/<int:blog_id>/ |
PUT |
Updates a specific blog post. Requires authentication and author ownership. |
/delete_blog/<int:blog_id>/ |
DELETE |
Deletes a specific blog post. Requires authentication and author ownership. |
To get a local copy of the project up and running, follow these steps.
-
Clone the Repository:
git clone https://github.com/meez-111/pyblogAPI.git cd pyblogAPI
-
Create and Activate a Virtual Environment:
python -m venv venv source venv/bin/activate
-
Install Dependencies:
pip install -r requirements.txt
-
Database Migrations:
python manage.py makemigrations python manage.py migrate
-
Create a Superuser (Optional):
python manage.py createsuperuser
-
Run the Development Server:
python manage.py runserver
The API will be available at
http://127.0.0.1:8000/
.
This project is deployed on Render using a PostgreSQL database.
- Build Script: A
build.sh
script automates the build process, including running migrations and collecting static files. - Start Command:
gunicorn pyblogapi.wsgi
- A persistent disk is configured on Render to ensure user-uploaded images remain available across deployments.
- Meez - meez-111
- LinkedIn: LinkedIn
- Email: meez.sabra.111@gmail.com