Code Monkey home page Code Monkey logo

cms_flask_project's Introduction

CMS Flask Project

CMS Flask Project is a python app that lets you create, edit and delete posts. It uses PostgreSQL as a persistent data storage.

Installation

First make sure you have PostgreSQL installed in the system you are using.

I suggest you install the app in it's own virtual envronment.

python -m venv venv

Then use the package manager pip to install the dependencies for the CMS.

pip install -r requirements.txt

The app defaults to using 127.0.0.1:5000 address.

You have to make .env file in the root dir of the app with the following environment variables:

SECRET_KEY=
DB_USER=
DB_PASSWORD=
DB_ADDRESS=
DB_PORT=
DB_NAME=

CAUTION Read the whole document before attempting to use this app. This app is not production ready!

Usage

There are 4 types of users that have different roles and permissions in the CMS. Each of them has a different endpoint for register and login:

Authors

POST http://app-ip-address/authors/register

POST http://app-ip-address/authors/login

Editors

POST http://app-ip-address/editors/register

POST http://app-ip-address/editors/login

Clients

POST http://app-ip-address/clients/register

POST http://app-ip-address/clients/login

Admins

POST http://app-ip-address/admins/register

POST http://app-ip-address/admins/login

On hitting both anedpoints you will receive a token that expires in two days.

Example response after hitting login endopoint:

{
    "token": <token>,
    "role": <role>
}

Roles and permissions

Authors can create, edit and delete its own posts.

Editors can edit and delete all posts from all Autors.

Admins can edit and delete all posts from all Autors and do the same with the user accounts. Only admins can register other admins.

TODO

Clients can make requests for advertising posts for which they will set a word limit, language etc.

Posts

Every post has an author and post content that is written in the database.

TODO

Authors should have CRUD only on their own posts.

Endpoints

As a regular nonregistered user you can seee all posts:

GET http://app-ip-address/posts

As a registered Author you can see all of your posts:

GET http://app-ip-address/authors/<pk of the author>/posts

As a registered Editor you can see,edit and delete all posts:

GET http://app-ip-address/posts

PUT http://app-ip-address/posts/<pk of the post>

DELETE http://app-ip-address/posts/<pk of the post>

Security

The security is accomplished with the help of JWT for login and register.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

cms_flask_project's People

Contributors

antonpetrov145 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

dlnan jasonhdavis

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.