Я пытаюсь развернуть приложение Flask в Ubuntu 16.04
Это выдает мне следующую ошибку, и я пытаюсь сделать это, используя python3.6
[Sat Feb 23 04:18:07.988418 2019] [wsgi:error] [pid 16429:tid 139859511379712] 3.5.2 (default, Nov 12 2018, 13:43:14)
[Sat Feb 23 04:18:07.988459 2019] [wsgi:error] [pid 16429:tid 139859511379712] [GCC 5.4.0 20160609]
[Sat Feb 23 04:18:07.988466 2019] [wsgi:error] [pid 16429:tid 139859511379712]
[Sat Feb 23 04:18:07.988488 2019] [wsgi:error] [pid 16429:tid 139859511379712] ['/var/www/EthApp/', '/var/www/EthApp/', '/var/www/EthApp/', '/var/www/EthApp/', '/var/www/EthApp/', '/var/www/EthApp/', '/var/www/EthApp/', '/var/www/EthApp/', '/var/www/EthApp/', '/var/www/EthApp/', '/var/www/EthApp/', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages']
[Sat Feb 23 04:18:07.989346 2019] [wsgi:error] [pid 16429:tid 139859511379712] [client 116.73.204.144:61239] mod_wsgi (pid=16429): Target WSGI script '/var/www/EthApp/ethapp.wsgi' cannot be loaded as Python module.
[Sat Feb 23 04:18:07.989391 2019] [wsgi:error] [pid 16429:tid 139859511379712] [client 116.73.204.144:61239] mod_wsgi (pid=16429): Exception occurred processing WSGI script '/var/www/EthApp/ethapp.wsgi'.
[Sat Feb 23 04:18:07.989519 2019] [wsgi:error] [pid 16429:tid 139859511379712] [client 116.73.204.144:61239] Traceback (most recent call last):
[Sat Feb 23 04:18:07.989553 2019] [wsgi:error] [pid 16429:tid 139859511379712] [client 116.73.204.144:61239] File "/var/www/EthApp/ethapp.wsgi", line 9, in <module>
[Sat Feb 23 04:18:07.989575 2019] [wsgi:error] [pid 16429:tid 139859511379712] [client 116.73.204.144:61239] from EthApp import app as application
[Sat Feb 23 04:18:07.989601 2019] [wsgi:error] [pid 16429:tid 139859511379712] [client 116.73.204.144:61239] File "/var/www/EthApp/EthApp/__init__.py", line 1, in <module>
[Sat Feb 23 04:18:07.989620 2019] [wsgi:error] [pid 16429:tid 139859511379712] [client 116.73.204.144:61239] from flask import Flask,render_template
[Sat Feb 23 04:18:07.989660 2019] [wsgi:error] [pid 16429:tid 139859511379712] [client 116.73.204.144:61239] ImportError: No module named 'flask'
Моя структура проекта:
EthApp
|_EthApp__
| |_static
| |_templates
| |_ __init__py
|_ethapp.wsgi
__ init__.py равно:
from flask import Flask,render_template
app = Flask(__name__)
@app.route("/")
def hello():
return render_template("main.html")
if __name__ == "__main__":
app.run()
ethapp.wsgi равно:
#!/usr/bin/python3.6
import sys
import logging
logging.basicConfig(stream=sys.stderr)
print(sys.version)
print(sys.path)
sys.path.insert(0,"/var/www/EthApp/")
from EthApp import app as application
application.secret_key = 'add key'
КогдаЯ пытаюсь отладить файл wsgi, используя:
$python3.6 -i /var/www/EthApp/ethapp.wsgi
3.6.7 (по умолчанию, 25 октября 2018, 09:16:13) [GCC 5.4.0 20160609] ['/ var/ www / EthApp ',' /usr/lib/python36.zip ',' /usr/lib/python3.6 ',' /usr/lib/python3.6/lib-dynload ',' / usr / local / lib/python3.6/dist-packages ',' / usr / lib / python3 / dist-packages ']