-1
Hello, I am trying to import a model to use inside my View and I am having problems, I made a test file to try to import before putting the model in the view. I already registered the app, I already made the "migrate" of it and even so it says that the model was not found. I tried to import it in the following ways:
from .models import *
from .models import ClassNameHere
from my_app.models import ClassNameHere
My model is in the same directory as the file I will use it in. It follows my code:
MY TEST FILE:
from student_base.models import Words
print('test')
My file of project Settings:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'student_base',
'django.contrib.sites',
'user_authentication',
#autentication
'allauth',
'allauth.account',
'allauth.socialaccount',
'pages.apps.PagesConfig',
'crispy_forms',
#My windown loggin
If I try to import the model and print a "Hello, world" later just to see if the import is occurring, the following error appears:
ImportError: attempted relative import with no known parent package
I already registered the app in Settings as mentioned
adds on the question to your project tree, doing the favor
– Carlos Cortez