你好世界 - 瓶/阿帕奇/ mod_wsgi的 - 没有来自Apache响应 [英] Hello World - Flask / Apache / mod_wsgi - no response from Apache

查看:138
本文介绍了你好世界 - 瓶/阿帕奇/ mod_wsgi的 - 没有来自Apache响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下面的 http://www.enigmeta.com教程/ 2012/08/16 /出发瓶/ 的开发和使用mod_wsgi的部署简单的瓶应用的Apache。我想我已经缩小它在我的Apache配置一个缺陷。如果我在命令行中运行helloflask.py,它工作正常。我可以通过从wget的另一个shell在本地主机访问它:5000,我也得到了正确的反应。我也有其他的虚拟主机(非WSGI)运行起来,所以我知道Apache正在运行,响应其他请求在端口80。

I am following the tutorial at http://www.enigmeta.com/2012/08/16/starting-flask/ to develop and deploy a simple flask app to Apache using mod_wsgi. I think I've narrowed it to a flaw in my Apache config. If I run helloflask.py from the command line, it works fine. I can access it via wget from another shell at localhost:5000, and I get the correct response. I also have other virtual hosts (non wsgi) up and running, so I know Apache is running and responding to other requests on port 80.

我有以下结构:

/sites/helloflask.mydomain.com
   /helloflask
      application.wsgi
      helloflask.py
      (rest of env from virtualenv)
   /log
      access.log
      error.log

helloflask.py:

helloflask.py:

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World!"

if __name__ == "__main__":
    app.run()

application.wsgi:

application.wsgi:

import os, sys, logging
logging.basicConfig(stream=sys.stderr)

PROJECT_DIR = '/sites/helloflask.mydomain.com/helloflask'

activate_this = os.path.join(PROJECT_DIR, 'bin', 'activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
sys.path.append(PROJECT_DIR)

from helloflask import app as application

Apache的配置:
/etc/apache2/sites-available/helloflask.mydomain.com

Apache config: /etc/apache2/sites-available/helloflask.mydomain.com

<VirtualHost *:80>
  ServerName helloflask.mydomain.com

  WSGIDaemonProcess helloflask user=myuser group=myuser threads=5
  WSGIScriptAlias / /sites/helloflask.mydomain.com/helloflask/application.wsgi

  <Directory /sites/helloflask.mydomain.com/helloflask>
    WSGIProcessGroup helloflask
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
  </Directory>
  LogLevel warn
  ErrorLog /sites/helloflask.mydomain.com/log/error.log
  CustomLog /sites/helloflask.mydomain.com/log/access.log combined
</VirtualHost>

我启用虚拟主机,重启apache,并没有得到来自浏览器的响应。 找不到服务器,所以没有500响应,什么都没有。在访问/错误日志没有条目(具体到这个虚拟主机)。我得到的总体Apache的错误下面我每次重新启动时登录:

I enable the vhost, restart apache, and get no response from the browser. "Server not found", so no 500 response, nothing. No entries in the access / error logs (specific to this vhost). I do get the following in the overarching Apache error log each time I restart:

[Sat Jun 29 20:07:58 2013] [notice] caught SIGTERM, shutting down
[Sat Jun 29 20:07:59 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Jun 29 20:07:59 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Jun 29 20:07:59 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.6 with Suhosin-Patch mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations

我想知道如果这两个[提醒]显示不同版本的Python线是我的问题,但我不知道怎样还是怎样修改来解决它。任何建议都AP preciated。

I'm wondering if those two [warn] lines indicating different versions of Python are my problem, but I don't know how or what to modify to fix it. Any suggestions are appreciated.

谢谢!

推荐答案

什么IP指向呢helloflask.mydomain.com什么?尝试添加

What ip does helloflask.mydomain.com point to? Try adding

127.0.0.1    helloflask.mydomain.com    helloflask

要你的hosts文件,并指着你的网页浏览器

To your hosts file, and pointing your web browser at

http://helloflask.mydomain.com

这篇关于你好世界 - 瓶/阿帕奇/ mod_wsgi的 - 没有来自Apache响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆