The content of this section
Django Rest Framework Installation
Django Rest framwwork Environment configuration
- Simple example Description
Using the rest framework in Django
1.1 Installing the Django rest Framework
Create a new environment
Virtualenv Envsource Env/bin/activate
Installationdjangorestframework 模块
Pip Install djangopip install djangorestframeworkpip install Markdown # markdown support for the browsable api.pip install Django-filter # Filtering Support
2 Django REST Framework Environment Configuration 1. Configuring the Settings file
Add ' rest_framework ' to the Installed_apps of the project configuration file settings
Add content to the last line of settings: Allow unauthenticated user read-only permissions
Rest_framework = { # use Django's standard ' Django.contrib.auth ' permissions, # or allow read-only access for Unau thenticated users. ' Default_permission_classes ': [ ' rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly ' ]}
3 Simple examples
Let's look at the directory structure of my Django project.
The first step is to add the rest framework's pointing information under the settings of the CRM
Urlpatterns = [ url (R ' ^api/', include (' Rest.urls ')),]
Asdfasdf
Python "24th Lesson" Django Rest Framework