esadakman / fs-blog-app-django-drf

Home Page:https://desad.pythonanywhere.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Full Stack - Blog App - Backend

Table of Contents

Overview

  • This is the backend side of my Full Stack Blog App project.
  • I used reactjs for frontend.
    You can see the frontend side of this project from here πŸ‘ˆ

Project Info

  • User and Blog tables are interconnected and each user has its own profile.
  • Users can update their user information and profile picture by coming to the profile section.
  • Users who have logged into the system can create, edit and delete their own posts.
  • In addition to creating your own posts, you can comment or like your own posts and other users' posts.
  • I did construct this structure using a generic view. In order to override Class methods, i did provide a if-else structures that should act accordingly whether the person is a authenticated or not. I did use IsAuthenticated from Rest framework permissions, IsAuthorOrReadOnly and IsAdminOrReadOnly from my custom permissions file.
  • I used django filters for searching posts and filtering user's own posts .
  • I used nested serializer and method fields in my serializers.
  • I used the cors-headers package to connect the frontend to my API.

Entity Relationship Diagram

erd

Project Link

You can reach my project from here πŸ‘ˆ

Preview of the Project

erd

Built With

  • Django
  • Django Rest Framework
  • Django Rest Auth
  • Django Rest Authtoken
  • Django Filter
  • Django Cors Headers
  • Swagger

Project Structure

.──── fs-django-blog-app-drf (repo)
β”‚
β”œβ”€β”€ main
β”‚     β”œβ”€β”€ __pycache__
β”‚     β”œβ”€β”€ __init__.py
β”‚     β”œβ”€β”€ asgi.py
β”‚     β”œβ”€β”€ urls.py
β”‚     β”œβ”€β”€ wsgi.py
β”‚     └── settings.py
│─── blog
β”‚       β”œβ”€β”€ __pycache__
β”‚       β”œβ”€β”€ migrations
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ admin.py
β”‚       β”œβ”€β”€ apps.py
β”‚       β”œβ”€β”€ models.py
β”‚       β”œβ”€β”€ pagination.py
β”‚       β”œβ”€β”€ permissions.py
β”‚       β”œβ”€β”€ serializers.py
β”‚       β”œβ”€β”€ signals.py
β”‚       β”œβ”€β”€ tests.py
β”‚       β”œβ”€β”€ urls.py
β”‚       └── views.py
β”œβ”€β”€β”€β”€ users
β”‚       β”œβ”€β”€ __pycache__
β”‚       β”œβ”€β”€ migrations
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ admin.py
β”‚       β”œβ”€β”€ apps.py
β”‚       β”œβ”€β”€ models.py
β”‚       β”œβ”€β”€ serializers.py
β”‚       β”œβ”€β”€ signals.py
β”‚       β”œβ”€β”€ tests.py
β”‚       β”œβ”€β”€ urls.py
β”‚       └── views.py
β”œβ”€β”€ .env
β”œβ”€β”€ .gitignore
β”œβ”€β”€ db.sqlite3
β”œβ”€β”€ drf-blog-erd.jpg
β”œβ”€β”€ manage.py 
β”œβ”€β”€ README.md 
└── requirements.txt

How To Use

To clone and run this application, you'll need Git

# Clone this repository
$ git clone https://github.com/esadakman/fs-django-blog-app-drf

# Install dependencies
    $ py -m venv env
    > env/Scripts/activate (for win OS)
    $ source env/bin/activate (for macOs/linux OS)
    $ pip install -r requirements.txt


# Add .env file for secret key and set your secret_key

- Create a .env file for =>
  -- SECRET_KEY,

- After these you can run the project as usual =>
    $ py manage.py migrate
    $ py manage.py createsuperuser

# Run the app
    $ python manage.py runserver

Contact