Error in application deploy Flask

0

I'm trying to deploy a flask application the same way I do when I'm using python2.7, but in this case I'm using python3 and an error is returned in wsgi. Below is the first line of the apache2 traceback.

[Thu Dec 06 23:01:04.823744 2018] [wsgi:error] [pid 21968:tid 139980181575424] [client 189.127.245.17:55892] mod_wsgi (pid=21968): Target WSGI script '/var/www/FlaskApp/flaskapp.wsgi' cannot be loaded as Python module.

I have installed the necessary packages correctly, including the libapache2-mod-wsgi-py3 which I believe to be the correct one for Python3.

FlaskApp.conf

<VirtualHost *:80>
  ServerName ip-do-servidor
  ServerAdmin admin-do-servidor
  WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi
  <Directory /var/www/FlaskApp/FlaskApp/>
      Order allow,deny
      Allow from all
  </Directory>
  Alias /static /var/www/FlaskApp/FlaskApp/static
  <Directory /var/www/FlaskApp/FlaskApp/static/>
      Order allow,deny
      Allow from all
  </Directory>
  ErrorLog ${APACHE_LOG_DIR}/error.log
  LogLevel warn
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

flaskapp.wsgi

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

from FlaskApp import app as application
application.secret_key = 'super_secret_key'
    
asked by anonymous 07.12.2018 / 00:17

1 answer

0

I was able to resolve it, the error was in my application and not in wsgi itself, I was able to see the correct error after descending to the last line of the apache error.log.

    
09.12.2018 / 23:49