# Install Django and Django REST framework into the virtual environment
pip install django
pip install djangorestframework
====================
# Set up a new project with a single application
django-admin startproject tutorial
cd tutorial
django-admin startapp quickstart
cd ..
====================
Now sync your database for the first time:
python [Link] migrate
============================
We'll also create an initial user named admin with a password of password123. We'll
authenticate as that user later in our example.
python [Link] createsuperuser --email admin@[Link] --username admin
=========================
we'd better write some views then
===============
now let's wire up the API URLs
================
Pagination allows you to control how many objects per page are returned. To enable
it add the following lines to tutorial/[Link]
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.[Link]',
'PAGE_SIZE': 10
}
=====================
Add 'rest_framework' to INSTALLED_APPS. The settings module will be in
tutorial/[Link]
INSTALLED_APPS = [
...
'rest_framework',
]
=========================
now ready to test the API we've built. Let's fire up the server from the command
line.
python [Link] runserver