У меня есть Django rest framework API.
При регистрации следующего маршрутизатора и добавлении шаблонов URL возникает следующая ошибка:
...
File "/home/yovel/PycharmProjects/scr/venv/lib/python3.8/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1011, in _gcd_import
File "<frozen importlib._bootstrap>", line 950, in _sanity_check
ValueError: Empty module name
Файл URL:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('api', include('farm_api.urls'))
]
Файл URL-адресов приложения:
from django.urls import include
from rest_framework.routers import DefaultRouter
from .views.group_view import GroupView
group_router = DefaultRouter()
group_router.register(prefix=r'groups', viewset=GroupView, basename='groups')
urlpatterns = [
include('', group_router.urls)
]