Когда я запускаю свой сервер, я получаю сообщение об ошибке, указывающее, что все мои URL-адреса недействительны. Я проверил орфографию, синтаксис и даже скопировал и вставил безрезультатно. Я просто хочу, чтобы он работал.
Я попытался исправить свое правописание, синтаксис, все.
Я использую простой сервер Django на Raspberry Pi 3 B
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name="index"),
path('suggest/', views.OwO, name="OwO"),
]
я тоже пробовал
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name="index"),
path('suggest', views.OwO, name="OwO"),
]
Мои взгляды
from django.shortcuts import render
from django.http import HttpResponse
from .forms import suggest
from .models improt message
# Create your views here.
def index(request):
form = suggest()
return render(request, 'index.html' {'form':form})
def OwO(request):
if request.method == 'POST':
form = sugest(request.POST)
if form.is_valid():
name = form.cleaned_data['name']
UwU = form.cleaned_data['messgae']
a = message(form_name=name, form_message=UwU)
a.save()
return HttpResponse("Thank you " + name + "!")
else:
Return HttpResponse("OwO")
Исключение:
Watching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/pi/.local/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/pi/.local/lib/python3.5/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/home/pi/.local/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "/home/pi/.local/lib/python3.5/site-packages/django/core/management/base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "/home/pi/.local/lib/python3.5/site-packages/django/core/management/base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "/home/pi/.local/lib/python3.5/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/pi/.local/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/pi/.local/lib/python3.5/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/home/pi/.local/lib/python3.5/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/pi/.local/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 'Suggest.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.