Install and use djangorestframework

This commit is contained in:
2021-04-01 20:36:29 -05:00
parent 567226684d
commit da85e74860
11 changed files with 51 additions and 1 deletions

View File

@@ -32,12 +32,14 @@ ALLOWED_HOSTS = []
INSTALLED_APPS = [
'bookmarks.apps.BookmarksConfig',
'apiv1.apps.Apiv1Config',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
]
MIDDLEWARE = [
@@ -121,3 +123,11 @@ USE_TZ = True
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
]
}

View File

@@ -22,5 +22,6 @@ urlpatterns = [
path('', views.home, name='home'),
path('bookmarks/', include('bookmarks.urls')),
path('admin/', admin.site.urls),
path('accounts/', include('django.contrib.auth.urls'))
path('accounts/', include('django.contrib.auth.urls')),
path('api/v1/', include('apiv1.urls')),
]