MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap
Revision 1 as of 2021-07-20 10:32:23
  • Python
  • DjangoREST

Django REST framework

  • https://www.django-rest-framework.org/tutorial/quickstart/#quickstart

Django REST framework is a powerful and flexible toolkit for building Web APIs.

Quickstart

  • Based on https://www.django-rest-framework.org/tutorial/quickstart/#quickstart

Toggle line numbers
   1 cd ~/tmp
   2 mkdir django-rest-test
   3 cd django-rest-test
   4 sudo apt install python3-venv
   5 python3 -m venv virtenv
   6 . virtenv/bin/activate
   7 pip install djangorestframework
   8 find . virtenv/
   9 django-admin startproject tutorial . 
  10 cd tutorial
  11 django-admin startapp quickstart
  12 cd ..
  13 python manage.py migrate # sync DB 
  14 python manage.py createsuperuser --email admin@example.com --username admin # create super user, pwd: 12345678 
  15 nano tutorial/quickstart/serializers.py
  16 nano tutorial/quickstart/views.py
  17 nano tutorial/urls.py
  18 nano tutorial/settings.py
  19 python manage.py runserver
  20 # Starting development server at http://127.0.0.1:8000/
  21 curl -H 'Accept: application/json; indent=4' -u admin:12345678 
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01