Hello,
I created sub app “slowa” in my app “angielski” then I added path to the INSTALLED_APPS and when I run server I get the following error:
Traceback (most recent call last):
File “C:\Users\krysz\AppData\Local\Programs\Python\Python310\lib\site-packages\django\apps\config.py”, line 245, in create
app_module = import_module(app_name)
File “C:\Users\krysz\AppData\Local\Programs\Python\Python310\lib\importlib_init_.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1050, in _gcd_import
File “”, line 1027, in _find_and_load
File “”, line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘slowa’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Users\krysz\AppData\Local\Programs\Python\Python310\lib\threading.py”, line 1009, in _bootstrap_inner
self.run()
File “C:\Users\krysz\AppData\Local\Programs\Python\Python310\lib\threading.py”, line 946, in run
self._target(*self._args, **self.kwargs)
File “C:\Users\krysz\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\autoreload.py”, line 64, in wrapper
fn(*args, **kwargs)
File “C:\Users\krysz\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\commands\runserver.py”, line 125, in inner_run
autoreload.raise_last_exception()
File “C:\Users\krysz\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\autoreload.py”, line 87, in raise_last_exception
raise exception[1]
File "C:\Users\krysz\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management_init.py", line 398, in execute
autoreload.check_errors(django.setup)()
File “C:\Users\krysz\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\autoreload.py”, line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\krysz\AppData\Local\Programs\Python\Python310\lib\site-packages\django_init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File “C:\Users\krysz\AppData\Local\Programs\Python\Python310\lib\site-packages\django\apps\registry.py”, line 91, in populate
app_config = AppConfig.create(entry)
File “C:\Users\krysz\AppData\Local\Programs\Python\Python310\lib\site-packages\django\apps\config.py”, line 247, in create
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Cannot import ‘slowa’. Check that ‘angielski.slowa.apps.SlowaConfig.name’ is correct.
Here’s my settings.py file:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'angielski.apps.AngielskiConfig',
'angielski.slowa.apps.SlowaConfig',
]
Structure:
slowa/apps.py:
from django.apps import AppConfig
class SlowaConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'slowa'
I’ve also tried add ‘slowa’ or ‘slowa.apps.SlowaConfig’ instead of a ‘angielski.slowa.apps.SlowaConfig’, but it still doesn’t work.
