简体   繁体   English

部署 Flask 应用程序时出现 dateutil 语法错误

[英]dateutil syntax error while deploying Flask Application

I am trying to deploy a flask application ( https://github.com/ihavemadefire/BestYearYet ) using Heroku.我正在尝试使用 Heroku 部署一个烧瓶应用程序( https://github.com/ihavemadefire/BestYearYet )。 When I deploy it it crashes immediately.当我部署它时,它立即崩溃。 I can't tell if the redirect is telling me there is an error in my code (It runs perfectly on a local browser port), an error in my virtual env or if there is an error in an external library.我不知道重定向是否告诉我我的代码中存在错误(它在本地浏览器端口上完美运行)、我的虚拟环境中的错误或外部库中是否存在错误。

I have tried updating the appdirs and flask-dateutil libraries.我尝试更新 appdirs 和 flask-dateutil 库。 I have tried deploying from the Heroku git cli and from Github.我曾尝试从 Heroku git cli 和 Github 进行部署。 I checked my code to see if I missed something (but like I said, it runs fine locally) I even tried rebooting.我检查了我的代码,看看我是否遗漏了什么(但就像我说的,它在本地运行良好)我什至尝试重新启动。 I think this problem is beyond my experience level.我认为这个问题超出了我的经验水平。

Here are the relevant error logs from Heroku (greatly truncated):以下是来自 Heroku 的相关错误日志(被大大截断):

File "/app/.heroku/python/lib/python3.6/site-packages/alembic/script/base.py", line 7, in from dateutil import tz File "/app/.heroku/python/lib/python3.6/site-packages/dateutil/tz.py", line 78 self._name , ^文件“/app/.heroku/python/lib/python3.6/site-packages/alembic/script/base.py”,第 7 行,在 from dateutil import tz 文件“/app/.heroku/python/lib/python3 .6/site-packages/dateutil/tz.py”,第 78 行self._name ,^

Uninstall python-dateutil:卸载 python-dateutil:

pip uninstall python-dateutil

And install the new version:并安装新版本:

i use this version我用这个版本

pip install python-dateutil==2.81

see if you have the requirements.txt file, remember to change the version of python-dateutil there too, manually or try this:看看你是否有requirements.txt文件,记得在那里更改python-dateutil的版本,手动或试试这个:

pip freeze > requirements.txt

if you don't have a requirements.txt, consider making one because it is "good practice" and is really helpfull如果您没有requirements.txt,请考虑制作一个,因为它是“很好的做法”并且非常有帮助

It looks like alembic depends on python-dateutil.看起来 alembic 依赖于 python-dateutil。 In your Requirements.txt make sure alembic comes after the dateutil entry and try pushing the app to heroku again.在您的Requirements.txt确保 alembic 出现在 dateutil 条目之后,然后再次尝试将应用程序推送到 heroku。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM