0

I'm doing some django stuffs using vs code and this error in the line 3 ("from") happend for no reason.

from django.urls import path
from * import views
urlpatterns = [path(" ",views,name="home")]

2 Answers 2

1

Your second import seems to be incorrect.

The syntax should be:

from <module> import <library / *>

In your case, it should be:

from views import *

That should be correct, as long as the views module do exist and can be found by python.

Sign up to request clarification or add additional context in comments.

Comments

0

You cannot import like from *. Python expects a package name after from. If you are trying to import it from the relative path it might be something like

from . import views

Its a valid syntax error, and it did not happen for no-reason!

2 Comments

it removed the problem but the error now is in the line 1 and it says "No name 'urls' in module 'django'"
I solved this by running "pip install pylint" inside my virtual environment

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.