from . import views ImportError: attempted relative import with no known parent package

Viewed 143

i just start to use django, and i got error when try to import in the "from . import views" part, this is my code

from django.urls import path
from . import views

urlpatterns = [
    path('',views.home,name='home')
]

and i have error message, which is
"ImportError: attempted relative import with no known parent package" can you show why it error, and the solution

1 Answers

try

from <app_name> import views

due to low reputation I am writing answer or else I could post it in comments

Related