Skip to content

This project is created from Django and Django Rest Framework

Notifications You must be signed in to change notification settings

ianshulx/community-blog

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started with Community BLog

This project is created from Django and Django Rest Framework. You can use Postman to test the API Endpoints. Once logged in, a token will generate and you can use the Token as Header:

  key: Authorization
  value: Bearer {generated token}

Setting up Project

In the project directory:

Install, Create, and activate Virtual Environment

pip install virtualenv
virtualenv venv
./venv/Scripts/activate

'venv' is you virtual environment name

Install Django and other library

  pip install -r requirements.txt

Perform the migration for database and models

python manage.py migrate

Run the project on your local

python manage.py runserver

Open http://localhost:8000/api/posts/ to view it in the browser.

Pre-populate data into Database

python manage.py loaddata sample-data.json
  • Signup for a new user, and login. This way you can see the pre-populated Posts and comments. You can create a new post and/or comment to existing posts.

Available Endpoints

  • User Endpoints
Signup - api/auth/signup/
Login - api/auth/login/
  • Posts Endpoints
Retrieve All Posts - api/posts/
Retrieve and Update Single Post  - api/posts/<id>/
Delete Post - api/posts/delete/<id>/

Retrieve Post by Logged in User - api/me/posts/
  • Comment Endpoints
Retrieve all comments on a post - api/post/<post_id>/comments/
Retrieve, Upate and Delete comment - api/post/<post_id>/comments/<comment_id>
  • Token API
api/gettoken/

About

This project is created from Django and Django Rest Framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%