【发布时间】:2014-06-30 07:20:44
【问题描述】:
我一直在尝试在 Ubuntu Web 服务器上部署我的应用程序,但收效甚微。我定义的虚拟主机文件是:
#WSGIRestrictStdout Off
<VirtualHost *:80>
ServerName demo.engineerinme.com
WSGIDaemonProcess fedoracollege user=engineer group=www-data threads=5
WSGIScriptAlias / /home/engineer/fedora-college/fedora_college.wsgi
<Directory /home/engineer/fedora-college/>
WSGIProcessGroup fedoracollege
WSGIApplicationGroup %{GLOBAL}
WSGIScriptReloading On
Options All ExecCGI Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
Alias /static /home/engineer/fedora-college/fedora_college/static
<Directory /home/engineer/fedora-college/fedora_college/static/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel debug
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
我面临的问题是,静态内容工作正常,但烧瓶应用程序没有运行。像http://demo.engineerinme.com 一样显示未找到错误。但http://demo.engineerinme.com/static 有效。
部署的wsgi脚本是:
#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/home/engineer/fedora-college/")
from fedora_college import app as application
application.secret_key = 'Add your secret key'
错误日志:
[Mon Jun 30 23:01:31 2014] [debug] mod_deflate.c(615): [client 59.177.114.30] Zlib: Compressed 233 to 180 : URL /
[Mon Jun 30 23:01:32 2014] [debug] mod_deflate.c(615): [client 59.177.114.30] Zlib: Compressed 233 to 180 : URL /
[Mon Jun 30 23:01:51 2014] [debug] mod_deflate.c(615): [client 59.177.114.30] Zlib: Compressed 233 to 180 : URL /
Access.log
59.177.114.30 - - [30/Jun/2014:23:01:32 +0400] "GET / HTTP/1.1" 404 441 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36"
59.177.114.30 - - [30/Jun/2014:23:01:51 +0400] "GET / HTTP/1.1" 404 442 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36"
应用程序的代码在这里:https://github.com/hammadhaleem/fedora-college/
对于可能的部署提供任何帮助将不胜感激。
谢谢
【问题讨论】:
-
请同时包含 apache 错误日志
-
@PaoloCasciello ,我已经添加了日志文件的输出。
-
不,我认为这不是强制性的。
-
@PaoloCasciello #已解决。谢谢:)
标签: python apache flask mod-wsgi