Django create Learning Notes Tip cannot import name 'views'

Task: create study notes-map URL
Code:

urls.py
"define URL schema for learning_logs"

from django.conf.urls import url

from. Import views

urlpatterns = [

]
-sharp 
url(r"^$",views.index,name = "index"),

]

execution tips are as follows:
Traceback (most recent call last):
File "I:python_worklearning_loglearning_logsurls.py", line 5, in < module >

from . import views

ImportError: cannot import name "views"

attach views code
views.py
from django.shortcuts import render

def index (request):

""""""
return render(request,"learning_logs/index.html")

Xiaobai asks for advice

Mar.17,2021

ImportError: cannot import name 'views'

I think you should upload your directory structure.


are you watching Python programming encounter this problem from beginner to practice?
it should be that from learning_logs import views has comments on urls.py. Django version has been upgraded, with some changes

.
Menu