I am building a site with django and cannot import views into my URL file.
My URL file:
from django.contrib import admin
from django.urls import path
from django.conf.urls import include
from . import views
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('blog.urls')),
]
Error: ImportError: cannot import name 'views' from 'blog' (..\blog\blog__init__.py)
If I try "from blog import views", I get the same error.
If I try "from blogapp import views" (blogapp is the name of the app within the blog foler), I get:
RecursionError: maximum recursion depth exceeded while calling a Python object.
Essentially, it bounces back and forth between line 23 in check_resolver (django\core\checks\urls.py) and line 397 in check (django\urls\resolvers.py).
If I try just: "import views", I get "ModuleNotFoundError: No module named 'views'"
My project structure: Main directory is "blog", contains two folders (blog and blogapp) as well as the db.sqlite3 and manage.py files.
Subfolder blog contains pycache folder, and these files: init.py, settings.py, urls.py, wsgi.py.
Subfolder blogapp contains pycache folder migrations folder, and these files: init.py, admin.py, apps.py, models.py, tests.py, views.py.
Both blog and blogapp are in my INSTALLED_APPS in settings.py.
I checked several similarly named questions (and their suggested answers) and could not figure out what is going wrong.