Есть вопрос , учусь настраивать nginx. Сейчас настраиваю flask.
Пока структура сайта такая
name_site
-
app
--
app.py
--
static
---
logo.png
-
env
установил virtuallenv,
запустил установил Flask
вот результат:
$ sudo pip freeze
click==6.7
Flask==0.12.2
itsdangerous==0.24
Jinja2==2.9.6
MarkupSafe==1.0
pycurl==7.43.0
pygobject==3.20.0
python-apt==1.1.0b1
unattended-upgrades==0.1
virtualenv==15.1.0
Werkzeug==0.12.2
The directory '/home/iz/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
потом я вышел из
virtuallenv командой
deactivate
ну а потом настраивал конфиги nginx ну и написал app.py:
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/')
def index():
return 'Flask is running!'
@app.route('/data')
def names():
data = {"names": ["John", "Jacob", "Julie", "Jennifer"]}
return jsonify(data)
if __name__ == '__main__':
app.run()
потом я захожу в папку
name_site/app/
и запускаю команду gunicorn app:app -b localhost:8000
а он мне выдает:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 515, in spawn_worker
worker.init_process()
File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 122, in init_process
self.load_wsgi()
File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 130, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/lib/python2.7/dist-packages/gunicorn/util.py", line 366, in import_app
__import__(module)
File "/var/www/itant/app/app.py", line 1, in <module>
from flask import Flask, jsonify
ImportError: No module named flask
[2017-10-09 17:17:14 +0000] [22142] [INFO] Worker exiting (pid: 22142)
[2017-10-09 17:17:14 +0000] [22137] [INFO] Shutting down: Master
[2017-10-09 17:17:14 +0000] [22137] [INFO] Reason: Worker failed to boot.
И вопрос почему?
Я с правами накjсячил опять или я что то пропустил, или не так запускаю?