Flask apache2 wsgi error after upgrading to ubuntu 20.04 from 18.04

176 views Asked by At

Today I upgraded my Ubuntu server (Digital Ocean Droplet) to 20.04 from 18.04. After upgrading, my Flask application getting WSGI error(s) and can't run the flask app. Here is the apache2 error log.

[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

Here is the code inside the webapp.wsgi file

#!/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'

Searched in Google and SO few hours but nothing found to fix the error. Can Someone tell me where is the error and a way to fixe this?.

0

There are 0 answers