Caros,
Estou com o seguinte erro meu projeto:
django.core.exceptions.ImproperlyConfigured: The included URLconf
'api.urls' does not appear to have any patterns in it. If you see
valid patterns in the file then the issue is probably caused by a
circular import.
Este projeto funcionava corretamente, porém tive que formatar minha máquina. Após baixar novamente os arquivos do meu git, começou a dar este problema.
Segue minha api.url:
from django.contrib import admin
from django.urls import include, path
from rest_framework import routers
from ChatBot.views import UserViewSet
from ChatBot.views import GroupViewSet
from django.conf.urls import url
router = routers.DefaultRouter()
router.register(r'users', UserViewSet)
router.register(r'groups', GroupViewSet)
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
path('', include(router.urls)),
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
path('admin/', admin.site.urls),
url(r'^', include('ChatBot.urls')),
]
Minha ChatBot.urls:
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^resultado/$', views.ClassRankingView.as_view(), name='resultado'),
url(r'^learning/$', views.WordEmbeddingCalculation.as_view(), name='learning'),
url(r'^weight/$', views.NovaViewTeste.as_view(), name='weight'),
]
O erro completo:
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/willian/ChatBot/venv/lib/python3.5/site-packages/django/urls/resolvers.py", line 581, in url_patterns
iter(patterns)
TypeError: 'module' object is not iterable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/willian/ChatBot/venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/home/willian/ChatBot/venv/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "/home/willian/ChatBot/venv/lib/python3.5/site-packages/django/core/management/base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "/home/willian/ChatBot/venv/lib/python3.5/site-packages/django/core/management/base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "/home/willian/ChatBot/venv/lib/python3.5/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/willian/ChatBot/venv/lib/python3.5/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/home/willian/ChatBot/venv/lib/python3.5/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/home/willian/ChatBot/venv/lib/python3.5/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/willian/ChatBot/venv/lib/python3.5/site-packages/django/urls/resolvers.py", line 588, in url_patterns
raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf 'api.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.
Este mesmo código, funciona em outras máquinas, porém na minha não. Saberiam me dizer o que pode estar acontecendo?
api.url
eapi.urls
em diferentes momentos. Não seria apenas um erro de digitação/nomenclatura?