Giter Club home page Giter Club logo

django-restful-api's Introduction

REST API Basics

the app is applied django rest-framework the stranth point :

  • authentication
  • view posts
  • create, update , retrive , delete (CRUD)
  • used some mixin inside of classes
  • visual API is the most usefull benifit

the endpoints are in local host

http://127.0.0.1:8000/api/postings // this for list and view
http://127.0.0.1:8000/api/postings/(?P<pk>\d+) // this is for CRUD oprations like this http://127.0.0.1:8000/api/postings/1

for deployment you have to use djanog-host for rubust uri and fetching and posting data to the server

the app is running on heruko on

useful command for django and deployment

$ python manage.py collectstatic //this is for collect the staticfiles in folder to serving online

$ python manage.py createsuperuser // to create admin user that is realted to your use

Software

thank for :

Initial Setup

virtualenv -p python3 restapi-basics

# activate it
# mac: `source bin/activate`
# windows: `.\Scripts\activate`

$pip install django==1.11.8 djangorestframework==3.7.3 djangorestframework-jwt==1.11.0

### Or you can do $pip install -r requirments.txt --user

mkdir src && cd src

django-admin startproject cfehome .
django-admin startapp postings

Update your settings to reflect the following:

INSTALLED_APPS = [
    ...
    'rest_framework',
    'postings'
]



REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAuthenticated',
    ),
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
        'rest_framework.authentication.SessionAuthentication',
        'rest_framework.authentication.BasicAuthentication',
    ),
}

django-restful-api's People

Contributors

tarek421995 avatar

Watchers

 avatar  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.