简体   繁体   中英

Issue with deployment flask and apache2 mod_wsgi

I'm just following everything they told in this doc but haven't figured out why apache2 throwing below error.

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

Update:

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'

If I remove the virtualenv activation line I'm getting no module named flask

Is anybody know how to solve...! I'm very happy to provide the further information

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

from instanotify.app import app as application

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM