未找到模块错误:使用heroku迁移文件时没有名为'django_apscheduler'的模块

vkc1a9a2  于 2022-11-13  发布在  Go
关注(0)|答案(1)|浏览(128)

我想用这个命令heroku run python manage.py migrate更新我的heroku站点,但是出现了错误:

»   Warning: heroku update available from 7.53.0 to 7.60.2.
Running python manage.py migrate on ⬢ mighty-harbor-18334... up, run.5980 (Free)
Traceback (most recent call last):
File "/app/manage.py", line 22, in <module>                                                                               
 main()
File "/app/manage.py", line 18, in main 
 execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
 utility.execute()
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 401, in execute
 django.setup()
File "/app/.heroku/python/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
 apps.populate(settings.INSTALLED_APPS)
File "/app/.heroku/python/lib/python3.10/site-packages/django/apps/registry.py", line 91, in populate
 app_config = AppConfig.create(entry)
File "/app/.heroku/python/lib/python3.10/site-packages/django/apps/config.py", line 223, in create 
 import_module(entry)
File "/app/.heroku/python/lib/python3.10/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 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_apscheduler'

我用pip install django_apscheduler安装了django_apscheduler。我的python版本是3.10.2,在我的settings.py中,应用模块在INSTALLED_APPS中,例如:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'myapp'
    'django_apscheduler',
]

我不知道为什么会发生ModuleNotFoundError,任何帮助都将不胜感激。

ycl3bljg

ycl3bljg1#

您 忘记 在 " myapp " 后面 的 INSTALLED _ APPS 中 放置 逗号

相关问题