我遵循了tutorial。这是我的服务器:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run()
运行时
python server.py
curl 127.0.0.1:5000
我得到了预期的结果。
现在我添加一个test.wsgi:
import sys
sys.path.insert(0, '/var/www/test')
from server import app as application
和/etc/apache2/sites-enabled/test.config:
<VirtualHost *:5000>
ServerName example.com
WSGIDaemonProcess test user=user1 group=user1 threads=5
WSGIScriptAlias / /var/www/test/test.wsgi
<Directory /var/www/test>
WSGIProcessGroup test
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
现在致电
sudo service apache2 restart
curl 127.0.0.1:5000
将返回错误。我做错了什么?
答案 0 :(得分:1)
丹尼尔罗斯曼指出,我需要
Listen 5000
添加到/etc/apache2/apache.conf
以使服务器侦听端口5000