I wanted to import my views.py file from my app "users" and the urls.py of the project. However, I'm getting an error that the "Import "users" could not be resolved".
The urls.py file:
from django.contrib import admin
from django.urls import path, include
from django.contrib.auth import views as auth_views
from users import views as user_views # Why is there an error?
urlpatterns = [
# Admin Page
path('admin/', admin.site.urls),
# Homepage
path('', include('blog.urls')),
path('register/', user_views.register, name = 'register'),
path('profile/', user_views.profile, name = 'profile'),
path('login/', auth_views.LoginView.as_view(template_name = 'users/login.html'), name = 'login'),
path('logout/', auth_views.LogoutView.as_view(template_name = 'users/logout.html'), name = 'logout'),
]
The app is also in "INSTALLED_APPS" in the settings.py file:
INSTALLED_APPS = [
'crispy_forms',
'users.apps.UsersConfig',
'blog.apps.BlogConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
This is probably an easy-to-solve problem, however, I'm fairly new to Django and don't really understand why it says this is an error. In a similar project, everything works fine.
No error in a similar project, where I did everything the same way as far as I remember.