Import Error: attempted relative import with known parent package

Making my first app with tutorial on django have this issue. How can I fix it? I try to import views from the same directory and have Import Error

Are you trying to run your urls.py file? It doesn’t make sense to do that.
Or is this just an error being displayed by your editor? If so, then you don’t need to worry about it.

I’m guessing you’re trying to work your way through the official Django tutorial?

Yes, I’m trying to use django tutorial .

from django.urls import path

from . import views

urlpatterns = [
path(“”, views.index, name=“index”),
]
So i open urls.py file in sublime text and just take away "from . ". Just keave import views. Maybe that was solution - i havent import error anymore. But thanks for your cooperation and answers)

No, that’s not the right solution.

Keep in mind that the polls directory is inside the mysite directory, and that the mysite directory is your “root” directory for your project.

You also need to be careful about the difference between what Django is doing when you run runserver and what your IDE/editor knows about when you’re working on a Django project. You do not want to fix “editor” errors if they don’t result in Django errors - and those only matter when you’re running runserver.

The tutorial is correct. If you make changes from what the tutorial is telling you to do without understanding the implications of those changes, you will encounter problems.

Ok, maybe strange question - where I must use this command - python manage.py runserver? I have powershell, but use sublime text

Sublime text is your editor / ide. I’m sure it has a facility to run commands from a command prompt or Powershell. (I know that Visual Studio Code does, I’m guessing Sublime text has the same facility.)

What I recommend initially is to work from the command prompt (or powershell) directly - get used to the commands and the errors they may show, before worrying about how to get it all working in your IDE.

You might want to read How to install Django on Windows | Django documentation | Django for information on running Django in Powershell.

You might also want to look for some specific Django-related information for Sublime Text. Maybe some blogs or other resources for how to best configure/use it with Django.