GithubHelp home page GithubHelp logo

gabrielsousa02 / tagarela Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 351 KB

It's only a sample project with a funny name. Tagarela in Portuguese means Chatterbox (FYI - That's the funny part). It's a minified backed-RESTFul API, of a twitter-like application.

Makefile 1.76% Python 98.24%
django django-rest-framework python

tagarela's Introduction

Tagarela

This is a sample project, demonstrating the usage of Django, Django REST Framework, Django-rest-knox.

What is Tagarela?

  • It's only a sample project with a funny name.
    • Tagarela in Portuguese means Chatterbox (FYI - That's the funny part)
  • It's a minified backed-RESTFul API, of a twitter-like application.

Installation:

  • Python version: 3.9.11

  • REQUIRED packages:

    • django>=4.0
    • django-rest-framework>=3.13.1
    • knox>=4.2.0
    • gunicorn>=20.1.0
    • psycopg2>=2.9.3
  • OPTIONAL packages:

    • django-filter>=22.1
    • Markdown>=3.3.7
    • black>=22.6.0
    • pylint>=2.14.4

It's highly recommended that you use a python virtual environment.

  • Tagarela is set to connect to a Postgresql database using these parameters:
         "default": {
         "ENGINE": "django.db.backends.postgresql_psycopg2",
         "NAME": "tagarela",
         "USER": "postgres",
         "PASSWORD": "",
         "HOST": "127.0.0.1",
         "PORT": "5432",
         }

Important:

  • This project is NOT meant for production as it is!!! The Django SECRET_KEY is only a sample key for testing.
  • If you want to use different database params, edit the path/to/tagarela/settings.py file.

Tagarela's Entity-Relationship Diagram

It can be run locally by following these steps:

  • Activate your local environment:

mac-OS and linux:

source ./.venv/bin/activate

Windows:

/.venv/Script/activate
  • Update pip and install all dependencies:

make install

or

make install-required

to install only the required packages.

Please note that some make features such as format and lint require the optional packages.

  • Run migrations to the database:

make migrations

  • Run locally:

make run

  • Optional features:
    • make format
      • This option will format your code using the black package.
    • make lint
      • This option will perform a static code analysis using the pylint package.

Example of usage

It can be found running on Heroku

  • Base URL: https://tagarela-test.herokuapp.com
  • Endpoints for user/account usage:
    • Register a user: /api/account/signup
         POST https://tagarela-test.herokuapp.com/api/account/signup
         Content-Type: application/json
         {
           "username": "Gabe",
           "first_name": "Gabe",
           "last_name": "Sousa",
           "password": "MySuperSafePassword",
           "email": "[email protected]"
         }
    • Login: /api/account/login
       POST https://tagarela-test.herokuapp.com/api/account/login
       Content-Type: application/json
       {
         "username": "Gabe",
         "password": "MySuperSafePassword",
       }
    • Logout from current device: /api/account/logout
       POST https://tagarela-test.herokuapp.com/api/account/logout
       Authorization: Token MySuperSafeToken-79e160a07bb5b976e7a87d60b4
    • Logout from all devices: /api/account/logoutall
       POST https://tagarela-test.herokuapp.com/api/account/logoutall
       Authorization: Token MySuperSafeToken-79e160a07bb5b976e7a87d60b4
    • See current user detail: /api/account/detail
       POST https://tagarela-test.herokuapp.com/api/account/detail
       Authorization: Token MySuperSafeToken-79e160a07bb5b976e7a87d60b4
    • List all users: /api/account/
       GET https://tagarela-test.herokuapp.com/api/account/logout
       Authorization: Token MySuperSafeToken-79e160a07bb5b976e7a87d60b4
    • Follow user by username: /api/account/follow
       PATCH http://localhost:8000/api/account/follow
       Authorization: Token MySuperSafeToken-79e160a07bb5b976e7a87d60b4
       Content-Type: application/json
      
       {
           "username": "john"
       }
    • Unfollow user by username: /api/account/unfollow
      PATCH http://localhost:8000/api/account/unfollow
      Authorization: Token MySuperSafeToken-79e160a07bb5b976e7a87d60b4
      Content-Type: application/json
      
      {
          "username": "john"
      }
  • Endpoints for posts:
    • See general feed: /api/post/general
       GET https://tagarela-test.herokuapp.com/api/post/general
       Authorization: Token MySuperSafeToken-79e160a07bb5b976e7a87d60b4
    • See personalized feed (Only users being followed): /api/post/
       GET https://tagarela-test.herokuapp.com/api/post/
       Authorization: Token MySuperSafeToken-79e160a07bb5b976e7a87d60b4
    • Create a post: /api/post
      POST https://tagarela-test.herokuapp.com/api/post/
      Authorization: Token MySuperSafeToken-79e160a07bb5b976e7a87d60b4
      Content-Type: application/json
      {
         "content": "Tweet 213214!"
      }

tagarela's People

Contributors

gabrielsousa02 avatar

Stargazers

 avatar

Watchers

 avatar

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.