尝试在Heroku上部署Flask应用程序,以前它与其他应用程序配合得很好,但现在当我尝试使用以下工具升级db时:
>:heroku run python manage.py db upgrade
我得到以下错误:
Traceback (most recent call last):
File "manage.py", line 121, in <module>
manager.run()
File "/app/.heroku/python/lib/python3.6/site-packages/flask_script/__init__.py", line 417, in run
result = self.handle(argv[0], argv[1:])
File "/app/.heroku/python/lib/python3.6/site-packages/flask_script/__init__.py", line 386, in handle
res = handle(*args, **config)
File "/app/.heroku/python/lib/python3.6/site-packages/flask_script/commands.py", line 216, in __call__
return self.run(*args, **kwargs)
File "/app/.heroku/python/lib/python3.6/site-packages/flask_migrate/__init__.py", line 259, in upgrade
command.upgrade(config, revision, sql=sql, tag=tag)
File "/app/.heroku/python/lib/python3.6/site-packages/alembic/command.py", line 254, in upgrade
script.run_env()
File "/app/.heroku/python/lib/python3.6/site-packages/alembic/script/base.py", line 425, in run_env
util.load_python_file(self.dir, 'env.py')
File "/app/.heroku/python/lib/python3.6/site-packages/alembic/util/pyfiles.py", line 85, in load_python_file
raise ImportError("Can't find Python file %s" % path)
ImportError: Can't find Python file migrations/env.py
文件迁移/环境。py位于我的本地计算机上,并且位于git存储库中:
>: git status migrations\env.py
On branch master
nothing to commit, working tree clean
在本地,我研究python 3.6.3,还尝试在Heroku上迁移到python 3.6.4,因为它说不支持3.6.3,但运气不好。
在本地,它可以正常工作,我可以迁移和升级DB(本地和heroku上的postgres)。
谢谢