mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-05-09 18:33:42 +03:00
Fix trailing whitespace
Sorry, my editor does this automatically
This commit is contained in:
parent
e2857bdcff
commit
a4470c4276
|
@ -93,7 +93,7 @@ Note that if deploying to [Apache using mod_wsgi][mod_wsgi_official], the author
|
||||||
|
|
||||||
If you are deploying to Apache, and using any non-session based authentication, you will need to explicitly configure mod_wsgi to pass the required headers through to the application. This can be done by specifying the `WSGIPassAuthorization` directive in the appropriate context and setting it to `'On'`.
|
If you are deploying to Apache, and using any non-session based authentication, you will need to explicitly configure mod_wsgi to pass the required headers through to the application. This can be done by specifying the `WSGIPassAuthorization` directive in the appropriate context and setting it to `'On'`.
|
||||||
|
|
||||||
# this can go in either server config, virtual host, directory or .htaccess
|
# this can go in either server config, virtual host, directory or .htaccess
|
||||||
WSGIPassAuthorization On
|
WSGIPassAuthorization On
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -117,7 +117,7 @@ Unauthenticated responses that are denied permission will result in an `HTTP 401
|
||||||
|
|
||||||
## TokenAuthentication
|
## TokenAuthentication
|
||||||
|
|
||||||
This authentication scheme uses a simple token-based HTTP Authentication scheme. Token authentication is appropriate for client-server setups, such as native desktop and mobile clients.
|
This authentication scheme uses a simple token-based HTTP Authentication scheme. Token authentication is appropriate for client-server setups, such as native desktop and mobile clients.
|
||||||
|
|
||||||
To use the `TokenAuthentication` scheme, include `rest_framework.authtoken` in your `INSTALLED_APPS` setting:
|
To use the `TokenAuthentication` scheme, include `rest_framework.authtoken` in your `INSTALLED_APPS` setting:
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ To use the `TokenAuthentication` scheme, include `rest_framework.authtoken` in y
|
||||||
...
|
...
|
||||||
'rest_framework.authtoken'
|
'rest_framework.authtoken'
|
||||||
)
|
)
|
||||||
|
|
||||||
Make sure to run `manage.py syncdb` after changing your settings. The `authtoken` database tables are managed by south (see [Schema migrations](#schema-migrations) below).
|
Make sure to run `manage.py syncdb` after changing your settings. The `authtoken` database tables are managed by south (see [Schema migrations](#schema-migrations) below).
|
||||||
|
|
||||||
You'll also need to create tokens for your users.
|
You'll also need to create tokens for your users.
|
||||||
|
@ -209,7 +209,7 @@ You can do so by inserting a `needed_by` attribute in your user migration:
|
||||||
needed_by = (
|
needed_by = (
|
||||||
('authtoken', '0001_initial'),
|
('authtoken', '0001_initial'),
|
||||||
)
|
)
|
||||||
|
|
||||||
def forwards(self):
|
def forwards(self):
|
||||||
...
|
...
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ Note that the `namespace='oauth2'` argument is required.
|
||||||
Finally, sync your database.
|
Finally, sync your database.
|
||||||
|
|
||||||
python manage.py syncdb
|
python manage.py syncdb
|
||||||
python manage.py migrate
|
python manage.py migrate
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ The following example will authenticate any incoming request as the user given b
|
||||||
user = User.objects.get(username=username)
|
user = User.objects.get(username=username)
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
raise exceptions.AuthenticationFailed('No such user')
|
raise exceptions.AuthenticationFailed('No such user')
|
||||||
|
|
||||||
return (user, None)
|
return (user, None)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
Loading…
Reference in New Issue
Block a user