Flask应用程序给出了“'NoneType'对象没有属性'drivername'“错误

时间:2019-05-12 09:37:03

标签: python sqlite nginx flask flask-sqlalchemy

我有一个VPS,我想在那里托管我的烧瓶应用程序。我遵循了DigitalOcean's教程“如何在Ubuntu 18.04上使用Gunicorn和Nginx服务Flask应用程序”(我没有从DO中获得VPS),并且在示例应用程序中一切正常……当我尝试替换文件时与我的应用程序的文件并再次托管该应用程序时,出现500错误。 500错误不会在任何地方出现。它出现在我的.db文件被卷入的位置,就像我有帖子或用户等的位置。 layout.html,页脚,导航,静态文件及其所有内容。

我已经尝试过重启服务器,检查env vars重载nginx等。但是没有任何效果。

当我在终端上运行sudo systemctl status appname时,我收到以下消息

gunicorn[971]:     return self.get_engine()
gunicorn[971]:   File "/home/apost/atapazar/atapazarvenv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py", line 
gunicorn[971]:     return connector.get_engine()
gunicorn[971]:   File "/home/apost/atapazar/atapazarvenv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py", line 
gunicorn[971]:     options = self.get_options(sa_url, echo)
gunicorn[971]:   File "/home/apost/atapazar/atapazarvenv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py", line 
gunicorn[971]:     self._sa.apply_driver_hacks(self._app, sa_url, options)
gunicorn[971]:   File "/home/apost/atapazar/atapazarvenv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py", line 
gunicorn[971]:     if sa_url.drivername.startswith('mysql'):
gunicorn[971]: AttributeError: 'NoneType' object has no attribute 'drivername'

我假设它是SQLite的探针。该网站应加载包含.db信息的.html文件。

编辑:已经在Stack上检查了另一个问题,甚至在Github上进行了检查,但没有找到解决方案。 同样,当我在本地计算机上运行该应用程序时,探针也不会显示。

0 个答案:

没有答案
相关问题