Skip to content

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Blog API

A RESTful blog backend built with Django and Django REST Framework. The project includes blog and category management, token-based authentication, user registration, filtering, search and pagination.

Django Blog API

Features

  • Blog CRUD API
  • Category CRUD API
  • User registration
  • Token-based login and authentication
  • Read-only access for anonymous users
  • Authenticated write access for blog content
  • Staff-only write access for categories
  • Search across blog title and content
  • Category filtering
  • Page-number pagination

Tech stack

  • Python
  • Django 4
  • Django REST Framework
  • django-filter
  • Token Authentication
  • SQLite

API endpoints

Endpoint Purpose
/api/blog/ List, create, retrieve, update and delete blog posts
/api/category/ List and manage categories
/user/register/ Register a user
/user/login/ Obtain an authentication token
/admin/ Django admin

Filtering and search

Blog posts can be filtered by category:

/api/blog/?category=1

Blog posts can be searched by title or content:

/api/blog/?search=django

Categories can be filtered by name:

/api/category/?name=Backend

Permissions

  • Blog endpoints are readable by everyone.
  • Creating, updating and deleting blog posts requires authentication.
  • Category endpoints are readable by everyone, while write operations require a staff user.

Local setup

1. Clone the repository

git clone https://github.com/omersb/Blog_App-django.git
cd Blog_App-django

2. Create and activate a virtual environment

macOS / Linux:

python3 -m venv venv
source venv/bin/activate

Windows:

python -m venv venv
venv\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Create environment variables

Create a .env file in the project root:

SECRET_KEY=your-django-secret-key

5. Apply migrations

python manage.py migrate

6. Optional: create an admin user

python manage.py createsuperuser

7. Run the development server

python manage.py runserver

The API will be available at:

http://127.0.0.1:8000/

Authentication

After registering a user, obtain a token from:

POST /user/login/

Authenticated API requests use DRF token authentication:

Authorization: Token <your-token>

Project structure

Blog_App-django/
├── blog/          # Blog and category API
├── user/          # Registration and login
├── main/          # Django project configuration
├── manage.py
└── requirements.txt

Author

Ömer Said Bulduk

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages