mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-16 19:41:06 +03:00
Enabled syntax highlighting in the README file.
This commit is contained in:
parent
fb3fcf0710
commit
f322e894ae
|
@ -48,6 +48,7 @@ Let's take a look at a quick example of using REST framework to build a simple m
|
|||
|
||||
Here's our project's root `urls.py` module:
|
||||
|
||||
```python
|
||||
from django.conf.urls.defaults import url, patterns, include
|
||||
from django.contrib.auth.models import User, Group
|
||||
from rest_framework import viewsets, routers
|
||||
|
@ -72,11 +73,13 @@ Here's our project's root `urls.py` module:
|
|||
url(r'^', include(router.urls)),
|
||||
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
|
||||
)
|
||||
```
|
||||
|
||||
We'd also like to configure a couple of settings for our API.
|
||||
|
||||
Add the following to your `settings.py` module:
|
||||
|
||||
```python
|
||||
REST_FRAMEWORK = {
|
||||
# Use hyperlinked styles by default.
|
||||
# Only used if the `serializer_class` attribute is not set on a view.
|
||||
|
@ -89,7 +92,7 @@ Add the following to your `settings.py` module:
|
|||
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
|
||||
]
|
||||
}
|
||||
|
||||
```
|
||||
Don't forget to make sure you've also added `rest_framework` to your `INSTALLED_APPS` setting.
|
||||
|
||||
That's it, we're done!
|
||||
|
|
Loading…
Reference in New Issue
Block a user