@wrathrone

Django проект выдает ошибку, что делать?

Traceback (most recent call last):
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\base.py", line 453, in execute
self.check()
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\base.py", line 485, in check
all_issues = checks.run_checks(
^^^^^^^^^^^^^^^^^^
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\checks\registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\checks\templates.py", line 39, in check_string_if_invalid_is_string
for conf in settings.TEMPLATES:
^^^^^^^^^^^^^^^^^^
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\conf\__init__.py", line 89, in __getattr__
self._setup(name)
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\conf\__init__.py", line 76, in _setup
self._wrapped = Settings(settings_module)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\conf\__init__.py", line 190, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1381, in _gcd_import
File "", line 1354, in _find_and_load
File "", line 1304, in _find_and_load_unlocked
File "", line 488, in _call_with_frames_removed
File "", line 1381, in _gcd_import
File "", line 1354, in _find_and_load
File "", line 1325, in _find_and_load_unlocked
File "", line 929, in _load_unlocked
File "", line 994, in exec_module
File "", line 488, in _call_with_frames_removed
File "C:\Users\Windows 10\Desktop\Fantastic-Django-Blog\djangoblog\__init__.py", line 6, in
from djangoblog.celery import app as celery_app
File "C:\Users\Windows 10\Desktop\Fantastic-Django-Blog\djangoblog\celery.py", line 6, in
from celery import Celery
ModuleNotFoundError: No module named 'celery'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Windows 10\Desktop\Fantastic-Django-Blog\manage.py", line 22, in
main()
File "C:\Users\Windows 10\Desktop\Fantastic-Django-Blog\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
utility.execute()
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\base.py", line 425, in run_from_argv
connections.close_all()
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\utils\connection.py", line 84, in close_all
for conn in self.all(initialized_only=True):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\utils\connection.py", line 76, in all
return [
^
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\utils\connection.py", line 73, in __iter__
return iter(self.settings)
^^^^^^^^^^^^^
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\utils\functional.py", line 47, in __get__
res = instance.__dict__[self.name] = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\utils\connection.py", line 45, in settings
self._settings = self.configure_settings(self._settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\utils.py", line 148, in configure_settings
databases = super().configure_settings(databases)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\utils\connection.py", line 50, in configure_settings
settings = getattr(django_settings, self.settings_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\conf\__init__.py", line 89, in __getattr__
self._setup(name)
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\conf\__init__.py", line 76, in _setup
self._wrapped = Settings(settings_module)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\conf\__init__.py", line 190, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Windows 10\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1381, in _gcd_import
File "", line 1354, in _find_and_load
File "", line 1304, in _find_and_load_unlocked
File "", line 488, in _call_with_frames_removed
File "", line 1381, in _gcd_import
File "", line 1354, in _find_and_load
File "", line 1325, in _find_and_load_unlocked
File "", line 929, in _load_unlocked
File "", line 994, in exec_module
File "", line 488, in _call_with_frames_removed
File "C:\Users\Windows 10\Desktop\Fantastic-Django-Blog\djangoblog\__init__.py", line 6, in
from djangoblog.celery import app as celery_app
File "C:\Users\Windows 10\Desktop\Fantastic-Django-Blog\djangoblog\celery.py", line 6, in
from celery import Celery
ModuleNotFoundError: No module named 'celery'

Скачал проект и захотел запустить, но не работает, пробовал делать миграции и мигрировать но выдавало все ту же ошибку
  • Вопрос задан
  • 144 просмотра
Пригласить эксперта
Ответы на вопрос 2
from celery import Celery
ModuleNotFoundError: No module named 'celery'

Последние строки прямо же говорят о проблеме.
p.s оформляйте вопрос правильно!
Ответ написан
Комментировать
@chemdev
в проекте должен быть файл с зависимостями.
Если он называется requirements.txt, то создайте окружение для своего проекта, активируйте и установите зависимости.
cd my_project_folder
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Команды актуальны для линукса
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы