0

今天我将我的 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 和 SO 中搜索了几个小时,但没有找到修复错误的方法。有人可以告诉我错误在哪里以及解决此问题的方法吗?

4

0 回答 0