Last active
November 28, 2019 09:28
-
-
Save delterr/88258dcc65ef6e0e046a9f2b041686da to your computer and use it in GitHub Desktop.
DRF basic setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set up for DRF | |
REST_FRAMEWORK = { | |
'DEFAULT_AUTHENTICATION_CLASSES': ( | |
'rest_framework.authentication.SessionAuthentication', # << Sets up default Authentication | |
), | |
'DEFAULT_PERMISSION_CLASSES': ( | |
'rest_framework.permissions.IsAuthenticatedOrReadOnly', # << Sets up default permissions for authenticated and read-only users | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.urls import path, include | |
from django.contrib import admin | |
urlpatterns = [ | |
path('admin/', admin.site.urls), | |
path('api_auth/', include('rest_framework.urls', namespace='rest_framework')), # << DRF url set up | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment