My urls.py and views.py files are in the same directory (my_app), after importing the views.py file from my urls.py file, whenever I try to start the development server I get a module import error: no module named views
but when I compile and run the urls.py file I get an import error: attempted relative import with no parent package
.
This is the code from urls.py:
from django.urls import path
from . import views
urlpatterns = [
path('', index, name='index')
]
I tried modifying the import statement for views into:
from views import index
and that removed the compilation error but not the server error.