部署烧瓶和 apache2 问题 mod_wsgi

Issue with deployment flask and apache2 mod_wsgi

我只是按照他们在此 doc 中所说的一切进行操作,但还没有弄清楚为什么 apache2 抛出以下错误。

root@Test1:/etc/apache2/sites-available# tail -5 /var/log/apache2/error.log 
[Sat Oct 17 04:22:13.518858 2015] [core:notice] [pid 28379] AH00094: Command line: '/usr/sbin/apache2'
[Sat Oct 17 04:22:18.930540 2015] [:error] [pid 28573] [client 223.190.213.33:33891] mod_wsgi (pid=28573): Exception occurred processing WSGI script '/var/www/instanotify/instanotify.wsgi'.
[Sat Oct 17 04:22:18.930623 2015] [:error] [pid 28573] [client 223.190.213.33:33891] TypeError: 'module' object is not callable
[Sat Oct 17 04:43:26.664459 2015] [:error] [pid 28575] [client 223.190.213.33:34215] mod_wsgi (pid=28575): Exception occurred processing WSGI script '/var/www/instanotify/instanotify.wsgi'.
[Sat Oct 17 04:43:26.664634 2015] [:error] [pid 28575] [client 223.190.213.33:34215] TypeError: 'module' object is not callable

更新:

root@Test1:/var/www/instanotify# cat instanotify.wsgi 
#!/usr/bin/python
import sys
import logging
# Virutalenv activattion
activate_this = '/var/www/instanotify/instanotify/env/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))

logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/instanotify/")

from instanotify import app as application
application.secret_key = 'Add your secret key'

如果我删除 virtualenv 激活行,我会得到 no module named flask

有谁知道怎么解决...!我很乐意提供更多信息

您没有导入实际的 app 文件...正确的方法是

from instanotify.app import app as application