为了账号安全,请及时绑定邮箱和手机立即绑定

Heroku 迁移:ModuleNotFoundError(怀疑静态问题)

Heroku 迁移:ModuleNotFoundError(怀疑静态问题)

杨__羊羊 2021-07-23 18:01:50
在尝试部署应用程序时,使用以下命令:heroku run python manage.py migrate错误Traceback (most recent call last):  File "manage.py", line 15, in <module>    execute_from_command_line(sys.argv)  File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line    utility.execute()  File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute    self.fetch_command(subcommand).run_from_argv(self.argv)  File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 224, in fetch_command    klass = load_command_class(app_name, subcommand)  File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 36, in load_command_class    module = import_module('%s.management.commands.%s' % (app_name, name))  File "/app/.heroku/python/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我怀疑这个问题是由我如何部署static. 特别是因为命令:python manage.py collectstatic返回以下错误:FileNotFoundError: [Errno 2] No such file or directory at: '/mnt/project/static/'。虽然,这可能是一个无关的问题。
查看完整描述

1 回答

?
烙印99

TA贡献1829条经验 获得超13个赞

正如@Selcuk 所说,问题是被Pipfile忽略的requirements.txt.

从基于requirements.txtto 的依赖项转换所需的步骤pipenv是:

$ pip install pipenv

$ pipenv install -r requirements.txt

$ pipenv lock


查看完整回答
反对 回复 2021-07-28
  • 1 回答
  • 0 关注
  • 148 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信