У меня возникли проблемы, пытаясь развернуть флягу приложение на сервере Amazon EC2.
Я последовал за учебник здесь и здесь , а также .
Когда я иду , чтобы запустить свой сервер, после выполнения sudo apachect1 restart
я получаю 500 Внутренней ошибку при переходе на мой ec2 сайт. Проверка журнала я получаю следующее сообщение об ошибке.
[Tue Jun 20 19:10:48.429468 2017] [wsgi:error] ImportError: No module named flask, referer: http://ec2-<MY-EC2-URL>.amazonaws.com/
Хотя еще через PuTTY я использую, чтобы получить доступ к экземпляру EC2, я могу видеть, Python и колба установлены делать ...
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type help, copyright, credits or license for more information.
>>> import flask
>>> flask.__version__
'0.12.2'
Что я думал , что это / прочитать это может быть проблемой не найти свой путь Python. Поэтому я добавил в мой файл конфигурации для Apache python-path=/usr/lib/python2.7
....
000-default.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin [email protected]
DocumentRoot /var/www/html
WSGIDaemonProcess leu threads=5 python-path=/usr/lib/python2.7
WSGIScriptAlias / /var/www/html/leu/app.wsgi
<Directory leu>
WSGIProcessGroup leu
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with a2disconf.
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Тем не менее, до сих пор не повезло. Я видел много с созданием виртуальных сред, но я не сделал этого. Первоначально я создал проект в PyCharm с помощью Python 3.5, но потом я вернулся через настройку проекта и создал его с Python 2.7 и добавлен весь соответствующий импорт. Еще не повезло, когда я сделал это.
Должен ли я снова перезагрузить с virtualenv? Есть ли что-то мне не хватает с настройкой Apache?
Я был в состоянии получить страницу выплеска для Apache говорят, что я поставил его правильно.
app.wsgi
import sys
sys.path.insert(0, 'var/www/html/leu')
from app import app as application
Любая помощь?
EDIT:
Кроме того, попытался изменить путь к Python в моем файле конфигурации Apache выше, /usr/local/lib/python2.7
но все - таки не повезло