Please help. ImportError with django 3.1

31 views
Skip to first unread message

Gasar Iyali

unread,
Jan 4, 2021, 8:24:56 AM1/4/21
to Django users
Hi
Please I need your help.
I have just installed django and when I try to run django I get this error message and nothing comes up in my browser.
This is the error message that I get in the command prompt

!*<<<(env) C:\Users\Documents\Learn Python\django\my_django_work\my_django_work\urls.py", line 19, in <module>
    from hello.views import index
ImportError: cannot import name 'index' from 'hello.views'>>>!!

Thank you

Mr. X Offencer

unread,
Jan 4, 2021, 9:38:58 AM1/4/21
to django...@googlegroups.com
why are you using
from hello.views import index

instead of 
from . import views

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cec9f80a-7d69-4702-8b4c-37817fc6caean%40googlegroups.com.

Josh Raj

unread,
Jan 4, 2021, 9:39:32 AM1/4/21
to django...@googlegroups.com
hello is ur app name if so
from hello import views 
try this 
if not be clear what is hello,index

--

Steven Mapes

unread,
Jan 5, 2021, 4:35:24 AM1/5/21
to Django users
Do you have a function in the hello/views.py? That's the first place to start as the error suggests you do not.

Mohammad Anarul

unread,
Jan 5, 2021, 9:54:00 AM1/5/21
to django...@googlegroups.com
file_name.pngurls.pngviews.png

You can try that if you want.

Reply all
Reply to author
Forward
0 new messages