次のurls.pyファイルがDjangoプロジェクトにあります。私は、URLとパスに関連する最新の構文に関するエラーが発生しています。DjangoのURLファイルのエラー
Iは、個人用サイト(最も外側のディレクトリ)にurl.pyあるURLをファイルに持たコードである:
from django.urls import path
from django.conf.urls import url, include
urlpatterns = [
path(r'^$', include('aboutme.urls')),
]
エラーメッセージは、次のとおりで
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
^$
The empty path didn't match any of these.
実際のアプリ(ウェブサイトフォルダ)は「aboutme」と呼ばれ、urls.pyファイルは次のようになります:
from django.urls import path
from django.conf.urls import url, include
from .import views #this is the main thing we are going to be doing ....returning views!
urlpatterns = [
path(r'^$', views.index,name='index'),
]
誰でも正しい構文を理解しているか、間違っていると思いますか?
UPDATE:
私はまた戻って、(以前に作業バージョンにあった)管理コマンドが含まれるようにメイン個人用サイトのurl.pyファイルを更新しようとしました。コードと結果のエラーは、以下の通りである:
は、このコードを試しました:
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
admin/
The empty path didn't match any of these.
更新されたコードの 'r '''にスペースがあります。空の文字列 ''''を使うべきです。 – Alasdair