Django 프로젝트에 다음 urls.py 파일이 있는데 URL과 경로와 관련된 최신 구문과 관련된 오류가 발생합니다.Django URLs 파일 오류
나는 내 사이트 (바깥 쪽 디렉토리)에 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 파일을 업데이트했습니다. 코드 및 결과 오류는 다음과 같습니다
이 코드를 시도 :
from django.contrib import admin
from django.urls import path
from django.conf.urls import url, include
urlpatterns = [
path('admin/', admin.site.urls),
path(r' ', include('aboutme.urls')),
]
오류
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