Django ModuleNotFoundError all of a sudden - python

All of a sudden, my django project is not working anymore. Not only my actual branch but even master. This happened after coming back to my project after the night. The error I have is when I run any command I have this message :
ModuleNotFoundError: No module named 'pur_beurre.pur_beurre'
(Note : pur_beurre is the name of my project)
When I run python manage.py, I have the list of all possible commands plus this new message in red :
Note that only Django core commands are listed as settings are not properly configured (error: No module named 'pur_beurre.pur_beurre').
I tried to put pur_beurre and pur_beurre.pur_beurre in my installed app in settings.py but its not working.
PS C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\pur_beurre> python .\manage.py runserver
Traceback (most recent call last):
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\core\management\base.py", line 373, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\core\management\commands\runserver.py", line 66, in execute
super().execute(*args, **options)
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\core\management\base.py", line 417, in execute
output = self.handle(*args, **options)
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\core\management\commands\runserver.py", line 73, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\conf\__init__.py", line 84, in __getattr__
self._setup(name)
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\conf\__init__.py", line 71, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\conf\__init__.py", line 179, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\tdechanet.TWM\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pur_beurre.pur_beurre'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".\manage.py", line 22, in <module>
main()
File ".\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\core\management\__init__.py", line 425, in execute_from_command_line
utility.execute()
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\core\management\__init__.py", line 419, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\core\management\base.py", line 386, in run_from_argv
connections.close_all()
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\db\utils.py", line 208, in close_all
for alias in self:
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\utils\connection.py", line 73, in __iter__
return iter(self.settings)
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\utils\connection.py", line 45, in settings
self._settings = self.configure_settings(self._settings)
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\db\utils.py", line 144, in configure_settings
databases = super().configure_settings(databases)
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\utils\connection.py", line 50, in configure_settings
settings = getattr(django_settings, self.settings_name)
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\conf\__init__.py", line 84, in __getattr__
self._setup(name)
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\conf\__init__.py", line 71, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\tdechanet.TWM\Documents\OpenClassrooms\p8\code\.venv\lib\site-packages\django\conf\__init__.py", line 179, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\tdechanet.TWM\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pur_beurre.pur_beurre'
Here is my installed apps :
INSTALLED_APPS = [
'main_site.apps.MainSiteConfig',
'user_management.apps.UserManagementConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]

the first line in manage.py is
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pur_beurre.settings')
which sets the standard path to settings BUT only as default if DJANGO_SETTINGS_MODULE has not been defined on system level.
Your error message looks like you have defined on windows a environement variabel DJANGO_SETTINGS_MODULE="pur_beurre.pur_beurre"
just to check add this line in manage.py at the beginning:
print(os.environ['DJANGO_SETTINGS_MODULE'])
Then check windows settings for the variabel, correct or delete and just in case reboot.

Related

PyCharm Django debug does not launch, while manage.py launches server perfectly

I am trying to debug Django project via PyCharm. While launching server with python manage.py runserver works perfectly, PyCharm's debug fails to start. Why can this happen?
Error traceback:
Traceback (most recent call last):
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\core\management\base.py", line 427, in run_from_argv
connections.close_all()
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\db\utils.py", line 212, in close_all
for alias in self:
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\utils\connection.py", line 73, in __iter__
return iter(self.settings)
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\utils\functional.py", line 49, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\utils\connection.py", line 45, in settings
self._settings = self.configure_settings(self._settings)
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\db\utils.py", line 148, in configure_settings
databases = super().configure_settings(databases)
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\utils\connection.py", line 50, in configure_settings
settings = getattr(django_settings, self.settings_name)
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\conf\__init__.py", line 88, in __getattr__
self._setup(name)
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\conf\__init__.py", line 75, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\conf\__init__.py", line 184, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Program Files\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'monitoring.monitoring'
python-BaseException

ImportError: cannot import name 'DEFAULT_CURRENCY' from 'moneyed' on Ubuntu

I've been using Django for just over a year for the development of an automation software and am currently just running the project locally on my windows machine.
I hadn't run into any issues with it, until I tried running cron tasks, which ofc windows doesn't support. Scheduled tasks don't work the same way imo, so I installed a Ubuntu VM to work with the project.
Set everything up correctly(I think?), installed Django and all. Currently installing all the libraries the project uses, one of which is django-money. I have installed it, as well as py-moneyed, yet on trying to make migrations, or run the server, I run into this error
enter image description here
Can't find anything about this online. The project still works perfectly with the windows command prompt, as well as PowerShell but having this issue on the ubuntu VM.
Installed apps on my settings.py look like:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'bootstrap5',
'sass_processor',
'djmoney',
'background_task',
'django_crontab',
'companies',
'google_cal',
'dashboard',
]
Any help on this, or good alternative for corn tasks-need some to run every 2 hours and update the db and others to run once a day at a specific time. Celery also does not work with Windows.
The full error is:
Traceback (most recent call last):
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv
/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv self.execute(*args, **cmd_options)
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 61, in execute super().execute(*args, **options)
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute output = self.handle(*args, **options)
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 68, in handle if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/conf/__init__.py", line 82, in __getattr__ self._setup(name)
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/conf/__init__.py", line 69, in _setup self._wrapped = Settings(settings_module)
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/conf/__init__.py", line 170, in __init__ mod =
importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/mnt/f/Django/RC/Sales-automation/sales-automation/automation_software/automation_software/settings.py", line 16, in <module>
from djmoney.settings import FIXER_ACCESS_KEY
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/djmoney/settings.py", line 6, in <module>
from moneyed import CURRENCIES, DEFAULT_CURRENCY, DEFAULT_CURRENCY_CODE
ImportError: cannot import name 'DEFAULT_CURRENCY' from 'moneyed' (/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/moneyed/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 22, in <module> main()
File "manage.py", line 18, in main execute_from_command_line(sys.argv)
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line utility.execute()
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute self.fetch_command(subcommand).run_from_argv(self.argv)
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/core/management/base.py", line 367, in run_from_argv connections.close_all()
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/db/utils.py", line 208, in close_all for alias in self:
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/utils/connection.py", line 73, in __iter__ return
iter(self.settings)
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__ res = instance.__dict__[self.name] = self.func(instance)
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/utils/connection.py", line 45, in
settings self._settings =
self.configure_settings(self._settings)
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/db/utils.py", line 144, in configure_settings databases =
super().configure_settings(databases)
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/utils/connection.py", line 50, in configure_settings settings = getattr(django_settings, self.settings_name)
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/conf/__init__.py", line 82, in __getattr__ self._setup(name)
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/conf/__init__.py", line 69, in _setup self._wrapped = Settings(settings_module)
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/django/conf/__init__.py", line 170, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in
_call_with_frames_removed
File "/mnt/f/Django/RC/Sales-automation/sales-automation/automation_software/automation_software/settings.py", line 16, in <module>
from djmoney.settings import FIXER_ACCESS_KEY
File "/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/djmoney/settings.py", line 6, in <module>
from moneyed import CURRENCIES, DEFAULT_CURRENCY, DEFAULT_CURRENCY_CODE
ImportError: cannot import name 'DEFAULT_CURRENCY' from 'moneyed' (/mnt/f/Django/RC/Sales-automation/sales-automation/ubuntu_venv/lib/python3.8/site-packages/moneyed/__init__.py)
That constant has been removed in version 2.0. See this link https://github.com/py-moneyed/py-moneyed/blob/ef5d65da3e6e774a377b6e1434a051f0454d2193/CHANGES.rst

Django server fails to start in Docker container

I have been trying to run an existing Wagtail/Vue implementation from https://github.com/hyshka/wagtail-vue-talk
I have gotten as far as installing Docker and setting up the containers, but when I try to run a Django server from container, it spits out the following code:
root#e7d407eba535:/app# django-admin.py runserver 0.0.0.0:8000
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/commands/runserver.py", line 60, in execute
super().execute(*args, **options)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 353, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/commands/runserver.py", line 67, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 57, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 107, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'wagtail_vue'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 329, in run_from_argv
connections.close_all()
File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 220, in close_all
for alias in self:
File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 214, in __iter__
return iter(self.databases)
File "/usr/local/lib/python3.5/dist-packages/django/utils/functional.py", line 37, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 147, in databases
self._databases = settings.DATABASES
File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 57, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 107, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'wagtail_vue'
So far I have checked the settings and requirements files, reinstalled containers a bunch of times. This error is often related to PATH configuration or __init__.py files, but all of that seems to be in place. Installed packages in docker container also seem to be correct.
The other container for Frontend works correctly, and my friend doing the same actions on MacOS got everything to work (I am on Windows 10).
The only option that I can think of at the moment is to move everything to Linux virtual environment, but I would like to avoid that.
Closing this question, as I found the "solution" myself.
After reinstalling and re-configuring everything multiple times I gave up and installed Ubuntu along with Win10 (dual boot), where it worked just as intended.

Django: No module named 'project'

I was working on a Django project on my personal laptop. Then I cloned the project to my work laptop and I'm getting a very weird error when I try to run any command, such as python manage.py runserver:
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 "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/core/management/base.py", line 336, in run_from_argv
connections.close_all()
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/db/utils.py", line 219, in close_all
for alias in self:
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/db/utils.py", line 213, in __iter__
return iter(self.databases)
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/db/utils.py", line 147, in databases
self._databases = settings.DATABASES
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 79, in __getattr__
self._setup(name)
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 157, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/Users/jmetz/miniconda3/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 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
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 'project'
Any idea what the issue is?
Add project to your INSTALLED_APPS in settings.py file
settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'project',
]
My solution to a similar problem was to export PYTHONPATH into my shell. That was throwing a warning about project, even though the INSTALLED_APPS was correct.

Django 'python manage.py runserver' has from config import* error

I have an error when i use django.
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/Users/ghk/djangoprojects/myvenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/Users/ghk/djangoprojects/myvenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 308, in execute
settings.INSTALLED_APPS
File "/Users/ghk/djangoprojects/myvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
self._setup(name)
File "/Users/ghk/djangoprojects/myvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/Users/ghk/djangoprojects/myvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 110, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/ghk/djangoprojects/lab-in-the-wild/labinthewild/settings.py", line 18, in <module>
from config import *
ModuleNotFoundError: No module named 'config'
If I command 'python manage.py runserver', it show this error.
As you said in your comments, you cloned this project from git.
Perhaps config is a local settings file you are meant to create yourself. Check the README and also check for a config example of some sorts

Categories