Giter Club home page Giter Club logo

mastori's Introduction

Screenshot from 2023-04-17 03-32-36

Python Django postgresql

CI Django & Postgres Tests

Jambo

Mastori: A SpaceYaTech Blog App made in Django

Mastori is a community-driven open-source project that aims to provide a simple and efficient blogging platform built with the Django Rest Framework.

Overview

The SpaceYaTech Content Management system is an open-application that lets users to quickly publish content and share it with ease to their audience. Inspired by existing CMSes like Hashnode, Wordpress, DEV and Joomla, we felt the need to create an African CMS created by young Africans looking to learn by contributing to Open Source. SpaceYaTech opted for a CMS as the debut open source project because of the technicalities involved in creating, maintaining and scaling a CMS. A CMS poses great technical challenges and a great learning opportunity for those looking to grow their tech skills. For a more detailed overview of the project, read through the CMS Backend wiki

The project is designed to help developers build their own blogging website or add blogging functionality to an the SpaceYaTech website with ease.

Endpoints

/mastori/

The /mastori/ endpoint allows retrieving all blog posts. GET requests to this endpoint retrieve a list of all blog posts

For complete documentation. Mastori Api Documentation

Authentication

/mastori/token/

Users

    /register/
    /login/

User Accounts

    /accounts/
    /accounts/id/

Blog Posts

    /mastori/
    /stori/id/
    /account/id/stori/
    /account/id/stori/id/

Comments

    /stori/id/comments/
    /stori/id/comment/id
    /account/id/stori/id/comment/
    /account/id/stori/id/comment/id/

Reactions

    /stori/id/reactions/
    /stori/id/reaction/id
    /account/id/stori/id/reaction/
    /account/id/stori/id/reaction/id/

Documentation

    /schema/docs/

Features

Mastori provides the following features:

  • Create, edit and delete blog posts
  • Publish, unpublish or delete blog posts
  • Tagging and categorizing posts
  • Searching for posts by title, content, tags or categories
  • User authentication and authorization
  • User profile management
  • Installation

To install Mastori, follow these steps:

  • Clone the repository: ```bash

          git clone https://github.com/yourusername/mastori.git
          ```
    
  • Create a virtual environment and activate it:

            python -m venv env
            source env/bin/activate
  • Install the required packages:

            pip install -r requirements.txt 
  • Set up the database:

            python manage.py migrate
  • Create a superuser:

            python manage.py createsuperuser
  • Run the server:

            python manage.py runserver

Usage

Once the server is running, you can access the API at http://localhost:8000/api/. You can use any HTTP client to interact with the API, such as curl or httpie. Alternatively, you can use the built-in API explorer by navigating to http://localhost:8000/api/docs/ in your web browser.

To access the admin panel, navigate to http://localhost:8000/admin/ and log in using the credentials of the superuser you created earlier.

The blog Api

The blog api {{baseurl}}/blog/ shows a list of all available blog posts (Stori/Mastori) The model naming is abitrary and can be subject to change if need be Ther is also need to filter out the various blogposts in relation ti their tittle or date posted hence the filter

image

Contributing

We welcome contributions from the community. To contribute, follow these steps:

  • Fork the repository
  • Create a new branch
  • Make your changes and commit them
  • Push your changes to your forked repository
  • Create a pull request

Please make sure to follow the coding style and conventions used in the project.

Get to read the Contributions guide here.

Commit message template

Just so that we have all our commit messages to be more readable and sensible it is recomended we use a template for the commit messages. Here is a commit message template that one should follow when making your Contributions

License

Mastori is licensed under the MIT License. See LICENSE for more information.

Contributor Features

Enviroment setup By @wanjirumurira 82d55a4

Project Setup By @sangkips 82bc556

User & Accounts By @hellen-22 1818b63

PhoneNumberField By @sangkips 615c011

Authentication (JWT) By @hellen-22 c2d7a90

Throttling policy By @Collins-Omariba 9159a8e

Verification richtext editor By @aibunny 25f991b

Fixed Workflow Build Error (commit #100) By @mosesmbadi b40a5b4

Nested Comments By @aibunny bbab06c

Authentication

JWT Authentication by: Hellen

Phone Numbers

Api Throttling

Api Throttling by:Collins

Nested Comments

Nested Comments by: Fredrick

Contributors

Contributors

mastori's People

Contributors

aibunny avatar ambroseotundo avatar blackhawk0 avatar chrisgathuthi avatar collins-omariba avatar collinskasyoki avatar eugene-kwaka avatar eva-wamuyu avatar hellen-22 avatar hudson-obai avatar ianonjuguna avatar ifedha avatar jimmyoty avatar jimmytron avatar jumalaw98 avatar laban254 avatar mamu234 avatar mosesmbadi avatar raykipkorir avatar rayphenom avatar sangkips avatar spaceyatech-org avatar wanjirumurira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mastori's Issues

Example .env file

I recently tried setting up the project for local development and upon following the steps and running the backend I met issues with missing env variables.

I would suggest adding a .env.example file to the project for easier setup by contributors. The example env file can contain values only used on the development machine.
The documentation could be modified to ask whoever's locally setting up the project to rename .env.example to .env.
Since the file is in .gitignore, it'll only affect the one setting up the project on their machine.

Phone number bug

Phone number is not showing on the admin side. If you want to update phone number, the phone number field isn't there. @hellen-22 can check it

UUIDs

User Attributes
Unique ID(UUID)

From the mvp the user id and most transaction ids needed to be unique

Api Throttling

API throttling is the process of limiting the number of API requests a user can make in a certain period. An application programming interface (API) functions as a gateway between a user and a software application.

While there are various algorithms for API throttling, here are the basic steps in any API throttling algorithm:

A client/user calls an API that interfaces with a web service or application.
The API throttling logic checks if the current request exceeds the allowed number of API calls.
If the request is within limits, the API performs as usual and completes the user’s task.
If the request exceeds the limit, the API returns an error response to the user.
The user will have to wait for a pre-agreed time period, or pay to make any more API calls.

Authentication Implementation

using non-native auth services to authenticate users to the application.

The authentication service makes sure that information is accessed only by users who have the access permission or right. The SpaceYaTech OpenSource CMS implements two forms of Authentication - JWT Authentication and Oauth 2.0 for Authentication and Authorization of Users within the Application. Here is a detailed look into the potential implementation of both forms of Authentication forms:
Read more here Authentication services

Tracking user activity

Tracking daily user data by selecting some basic information about people who visit the app including those who successfully logged in, logged out or who logged in failed. or simply get the overall statistics of those who visited.

Users & Accounts endpoints

To use the Djoser library to handle the user, accounts, and authentication
Djoser is a popular Django package that provides a set of ready-to-use REST API endpoints for user authentication and registration.

Environment settings

These are the environment settings for the project.
To help set a standard for transferability of the project.

Hide draft posts from the mastori listing

Filter the draft posts from appearing on the post list
I created some posts and had most of them as drafts but when i checked the post listing they all appeared which should not be the case

To Reproduce
Steps to reproduce the behavior:

  1. login and create a new post
  2. mark the post as Draft
  3. Query the posts list
  4. See the issue?

Expected behavior
A draft post should not display on the posts listing
Screenshots
image

Project skeleton

Hi there,

@sangkips once the environment settings issue is resoled by @wanjirumurira and @mamu234

pull the changes and create an empty project.

Create a new branch and push it upstream.

  • Don't forget to open a pull request πŸ˜‰

Unauthorized session can create new categories

Describe the bug
Sending a POST request on the 'categories' endpoint with a category name creates a new category. This happens even on an anonymous session without having provided login credentials or a valid token.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the 'categories' URL. If running locally, go to 'http://localhost:8000/categories'
  2. Create a POST request with an input called 'name' and a value of any category name
  3. Submit the request

Expected behavior
The endpoint should reject the request and prompt for authentication credentials before creating the new category.

Screenshots
image
The screenshot shows that the category is successfully created in an unauthorized environment.

Desktop (please complete the following information):

Handling Images

Pillow is an image library that we shall use to manipulate our images.
We need to tell Django which URL to use for serving the media files and also specify the root directory where our images will be stored.

Multiple duplicate migrations for the user model

Describe the bug
Running 'python manage.py makemigrations' results in a duplicate migration being generated every time for the user model in the accounts app.

To Reproduce
Steps to reproduce the behavior:

  1. Run 'python manage.py makemigrations'
  2. A new migration for the user model in the accounts application is created.
  3. Run 'python manage.py makemigrations'.
  4. A similar migration with a different verification ID is created.

Expected behavior
Only one migration for each specific change should be created.

Screenshots
migration_issue

Desktop:

  • OS: Linux Mint
  • Browser: Chrome
  • Version: 117

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Blog App

Being a core service required for this CMS project the blog app is a timely implement.
BlogService (Fetch blogs, create blogs, update blogs, delete blogs)(posts/1)

Creation of the blog app
some of the highlighted features from modeling the blog app that were agreed upon are as follows:

  • Blog Posts -
    • Unique Id(PK),
    • Post title
    • Description (small section which highlights the blog post)
    • Content (main content of the post)
    • UserId(FK)
    • Status
    • Date_Created
    • Date_updated
    • Date_Published
    • CategoryID (FK)
    • Images Urls (Post can have multiple multimedia files)
    • Number of Views
  • Reactions (Set of ReactionsLike or upvote or a downvote)
  • Comments

Here is a sample blog from the labs
credits: @Fredrick-Waihenya
image

clearing pycache files

    Since the pychache files are already in a commit adding gitignore here is not enough, you have to clean the branch up so the files are ignored

Do the following:

git rm -r --cached .
git add .
git commit -m "<commit_message_addressing_cleanup>"

Originally posted by @nyandika in #19 (comment)

Blog Comments

**The blog comments should have the following fields : **

  • id( unique id)
  • body -the content of the comment
  • user id (FK) -links the comment to a specific user who created/ commented
  • post id (FK) -link the comment to a specific post
  • date created
  • date flagged
  • List of Reactions

Additional context
Add any other Functionality that seems necessary
this is a screenshot of Medium
image

Environment setup(REOPENED)

Discussed in #12

Originally posted by mamu234 October 31, 2022

  1. install python - the latest python version in my case is 3.8
  2. Install django using the following command - pip install django (this will install django without specifying the version)
  3. Create a virtual environment using the following command - python3 -m venv env
  4. Activate the virtual environment - source env /bin/activate
  5. Install a list of modules needed to run the project by - pip install -r requirements.txt
  6. Check the modules that have been installed by - pip freeze

blog post

creating a model for the blog post

Drafts Page

Drafts Page
A page where the blog owner get to view their draft posts

Custom permission IsBlogOwner
Make a custom permission class to only allow for the blog owner to view their draft posts.
This should restrict other users from viewing their drafts.

Handling phone number fields

Find a better way to have phone numbers handle international phone number formats such as +1 777777. This way it will be better to handle users' phone numbers globally.

Featured Stori

Featured Stori

image

Add a featured field to make it easy to flag Stories that should be featured on the website

Featured Field:

Checkbox or boolean input to designate if the Stori should be listed as featured on the website.

Missing pre-dev branch

The pre-dev branch to contribute to as directed by the contributions.md is missing.
The contribution guide suggests:
git checkout -b <issue-number-title> pre-dev

What happens after running:
$ git checkout -b issue-x-do-something pre-dev fatal: 'pre-dev' is not a commit and a branch 'issue-x-do-something' cannot be created from it

This leaves contributors to branch from the main branch which ideally should only be used for releases.

Improved Application Dependencies Management

Description:
The current method of listing application dependencies in a text file is proving to be challenging to track and manage effectively. I suggest implementing a more managed approach to handle dependencies, such as utilizing a package manager or dependency management tool.

Reactions

Reactions

  • id(unique id)
  • type -( up vote/down vote or like/dislike)- enumerated value
  • user_id (FK) - links the reaction to a specific user who created it
  • post_id
  • comment_id
  • date created,updated

The reactions are in a way used to communicate emmotions without having to acctually reply to the blog or comment

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.