3. Quickstart
# Create the project directory
mkdir file_demo
cd file_demo
# Create a virtualenv to isolate our package dependencies locally
virtualenv env
source env/bin/activate
# Install Django and Django REST framework into the virtualenv
pip install django
pip install djangorestframework
# Set up a new project with a single application
django-admin.py startproject tutorial .
cd tutorial
mkdir file # Save upload files
django-admin.py startapp quickstart
# Now sync your database for the first time:
python manage.py migrate
# Create AdminUser and runserver
python manage.py createsuperuser
blank x@x.com 1234 # (username, e-mail, password)
python manage.py runserver 0.0.0.0:8669
7. Views (1/3)
• Open file_demo/tutorial/quickstart/views.py
http://www.django-rest-framework.org/api-guide/views/#function-based-views
Serializersl
Model
Views