Code Monkey home page Code Monkey logo

api-server-django's Introduction

Simple starter built with Python / Django Rest / Sqlite3 and JWT Auth. The authentication flow is built with json web tokens.


Features:

  • โœ… Up-to-date dependencies
  • โœ… API Definition - the unified API structure implemented by this server
  • โœ… Django / DRF / SQLite3 - a simple, easy to use backend
  • โœ… JWT Authentication (login, logout, register)
  • ๐Ÿ†• OAuth for Github
  • โœ… Docker, Unitary tests

Can be used with other React Starters for a complete Full-Stack experience:

React Node JS Berry React Node Soft Dashboard React Node Horizon
React Node JS Berry React Node Soft Dashboard React Node Horizon

Nodejs API Server - Open-source Nodejs Starter provided by AppSeed.


โœจ Quick Start in Docker

๐Ÿ‘‰ Get the code

$ git clone https://github.com/app-generator/api-server-django.git
$ cd api-server-django

๐Ÿ‘‰ Start the app in Docker

$ docker-compose up --build  

The API server will start using the PORT 5000.


โœจ How to use the code

๐Ÿ‘‰ Step #1 - Clone the sources

$ git clone https://github.com/app-generator/api-server-django.git
$ cd api-server-django

๐Ÿ‘‰ Step #2 - Create a virtual environment

$ # Virtualenv modules installation (Unix based systems)
$ virtualenv env
$ source env/bin/activate
$
$ # Virtualenv modules installation (Windows based systems)
$ # virtualenv env
$ # .\env\Scripts\activate

๐Ÿ‘‰ Step #3 - Install dependencies using PIP

$ pip install -r requirements.txt

๐Ÿ‘‰ Step #4 - Create a new .env file using sample env.sample

The meaning of each variable can be found below:

  • DEBUG: if True the app runs in develoment mode
    • For production value False should be used
  • SECRET_KEY: used in assets management
  • GITHUB_CLIENT_ID: For GitHub social login
  • GITHUB_SECRET_KEY: For GitHub social login

๐Ÿ‘‰ Step #5 - Start the API server

$ python manage.py migrate
$ python manage.py runserver

The API server will start using the default port 8000.


โœจ Tests

$ python manage.py test

โœจ API

For a fast set up, use this POSTMAN file: api_sample

Register - api/users/signup

POST api/users/signup
Content-Type: application/json

{
    "username":"test",
    "password":"pass", 
    "email":"[email protected]"
}

Login - api/users/login

POST /api/users/login
Content-Type: application/json

{
    "password":"pass", 
    "email":"[email protected]"
}

Logout - api/users/logout

POST api/users/logout
Content-Type: application/json
authorization: JWT_TOKEN (returned by Login request)

{
    "token":"JWT_TOKEN"
}


Django API Server - provided by AppSeed

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.