ModuleNotFoundError: No module named 'apps.endpointsapps'

Viewed 1650

I am very new to python and linux, I was trying to create an app from a tutorial and this happend when I tried to run a test of my model.

(venv) kali@kali:~/machinelearning/backend/server$ python manage.py test apps.ml.tests
Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/home/kali/machinelearning/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/kali/machinelearning/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
    django.setup()
  File "/home/kali/machinelearning/venv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/kali/machinelearning/venv/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/home/kali/machinelearning/venv/lib/python3.7/site-packages/django/apps/config.py", line 116, in create
    mod = import_module(mod_path)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'apps.endpointsapps'

This is my first question on stackoverflow too

2 Answers

Please add empty __init__.py file in the apps folder so that it can be recognized by Python as a package.

Check this link out. link

Can you please post the project structure you have? Basically just want to see where that apps exists.

You need to add an empty init.py (4 underscores in total) file in the apps folder for it to be recognized by Python as a package.

Have a look at the documentation for more informations.

Related