从18.04升级到ubuntu 20.04后出现Flask apache2 wsgi错误

问题描述

今天,我将ubuntu服务器(Digital Ocean Droplet)从18.04升级到20.04。升级后,我的Flask应用程序出现Wsgi错误,并且无法运行flask应用程序。这是apache2错误日志。

[Wed Sep 30 14:02:19.652956 2020] [wsgi:error] [pid 2335] [client 121.128.137.103:53959] SyntaxError: invalid Syntax
[Wed Sep 30 14:02:31.864498 2020] [wsgi:error] [pid 2329] [client 121.128.137.103:53961] mod_wsgi (pid=2329): Failed to exec Python script file '/var/www/webApp/webapp.wsgi'.
[Wed Sep 30 14:02:31.864542 2020] [wsgi:error] [pid 2329] [client 121.128.137.103:53961] mod_wsgi (pid=2329): Exception occurred processing Wsgi script '/var/www/webApp/webapp.wsgi'.
[Wed Sep 30 14:02:31.864566 2020] [wsgi:error] [pid 2329] [client 121.128.137.103:53961] Traceback (most recent call last):
[Wed Sep 30 14:02:31.864590 2020] [wsgi:error] [pid 2329] [client 121.128.137.103:53961]   File "/var/www/webApp/webapp.wsgi",line 7,in <module>
[Wed Sep 30 14:02:31.864668 2020] [wsgi:error] [pid 2329] [client 121.128.137.103:53961]     from webApp import app as application
[Wed Sep 30 14:02:31.864728 2020] [wsgi:error] [pid 2329] [client 121.128.137.103:53961]   File "/var/www/webApp/webApp/__init__.py",line 326
[Wed Sep 30 14:02:31.864735 2020] [wsgi:error] [pid 2329] [client 121.128.137.103:53961]     res = make_response(jsonify({"message": f" File Is Exceeded The Maximum Size Limit"}),403)
[Wed Sep 30 14:02:31.864740 2020] [wsgi:error] [pid 2329] [client 121.128.137.103:53961]                                                                                       ^
[Wed Sep 30 14:02:31.864745 2020] [wsgi:error] [pid 2329] [client 121.128.137.103:53961] SyntaxError: invalid Syntax

这是webapp.wsgi文件中的代码

#!/usr/bin/python3
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/webApp/")

from webApp import app as application
application.secret_key = 'someSecret_k*eY'

在Google和Google中搜索了几个小时,但没有找到可解决错误的信息。有人可以告诉我错误在哪里以及解决此问题的方法吗?。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)