Reputation: 1
I am at my wit's end as I am trying to debug and figure out what the issue is. When trying to search, I just get annoyingly AI responses which I don't want so decided to write a question here on SO.
Here is my traceback:
Traceback (most recent call last):
File "/api/manage.py", line 22, in <module>
main()
File "/api/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 416, in execute
django.setup()
File "/usr/local/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.9/site-packages/django/apps/registry.py", line 116, in populate
app_config.import_models()
File "/usr/local/lib/python3.9/site-packages/django/apps/config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/api/api/companies/models.py", line 5, in <module>
from backend.api.models import BaseModel
ModuleNotFoundError: No module named 'backend.api'
make: *** [seed] Error 1
Here is my settings.py INSTALLED_APPS:
INSTALLED_APPS = [
# Local apps
'api',
'api.companies',
'api.assessments',
'api.users',
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
]
Here is my file structure if it helps. Is there something I am missing to get this working?
neurointerview/
├── backend/ # Django backend
│ ├── api/ # Django app for API
│ │ ├── assessments/ # Assessment functionality
│ │ │ ├── __init__.py # Python package initialization
│ │ │ ├── models.py # Assessment data models
│ │ │ ├── serializers.py # API serializers for assessments
│ │ │ └── views.py # API endpoints for assessments
│ │ │
│ │ ├── companies/ # Company functionality
│ │ │ ├── __init__.py # Python package initialization
│ │ │ ├── models.py # Company data models
│ │ │ ├── serializers.py # API serializers for companies
│ │ │ └── views.py # API endpoints for companies
│ │ │
│ │ ├── management/ # Django management commands
│ │ │ └── commands/
│ │ │ └── seed_demo_data.py # Data seeding utility
│ │ │
│ │ ├── migrations/ # Database migrations
│ │ │ └── 0001_initial.py # Initial migration
│ │ │
│ │ ├── users/ # User functionality
│ │ │ ├── __init__.py # Python package initialization
│ │ │ ├── models.py # User data models
│ │ │ ├── permissions.py # Permission classes
│ │ │ └── serializers.py # API serializers for users
│ │ │
│ │ ├── models.py # Core API models
│ │ └── views.py # Core API views
│ │
│ ├── backend/ # Django project configuration
│ │ ├── settings.py # Project settings
│ │ └── urls.py # URL routing configuration
│ │
│ └── manage.py # Django command-line utility
For anyone further curious this is my GitHub and feel free to pull and help fix if you want. Been working on this and trying to clean things up a bit more: https://github.com/samsterpiece/neurointerview
So far, I have tried redoing my project structure entirely to what I have mapped out, in addition to doing relative imports to see if that would alleviate the problem. What I expected was that when I ran my make seed, I can populate my test database with some data.
relative import example:
from ..models import BaseModel
Upvotes: 0
Views: 42