Skip to content

Instantly share code, notes, and snippets.

@delterr
Last active November 28, 2019 09:28
Show Gist options
  • Save delterr/88258dcc65ef6e0e046a9f2b041686da to your computer and use it in GitHub Desktop.
Save delterr/88258dcc65ef6e0e046a9f2b041686da to your computer and use it in GitHub Desktop.
DRF basic setup
# 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
)
}
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