django-rest-imageupload-example
django-rest-imageupload-example copied to clipboard
Need to add app_name in urls.py for step 3
Environment:
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13)
Django==2.1.7
django-filter==2.1.0
djangorestframework==3.9.1
Markdown==3.0.1
Pillow==5.4.1
pytz==2018.9
Error in step 3 when adding the API urls to the backend for browsing:
File "/.../django-rest-imageupload-example/venv/lib/python3.6/site-packages/django/urls/conf.py", line 39, in include
'Specifying a namespace in include() without providing an app_name '
django.core.exceptions.ImproperlyConfigured: Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.
ref: https://code.djangoproject.com/ticket/28691
fix is to add the line app_name="imageupload_rest"
to imageupload_rest/urls.py
from django.conf.urls import url, include
from rest_framework import routers
app_name="imageupload_rest"
router = routers.DefaultRouter()
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
url(r'^', include(router.urls)),
]
also chapter1/step5