我正在嘗試將金字塔應用程序推出到生產站點。滾動金字塔應用程序到生產站點
截至目前,我已經創建了其中的應用程序放置在出的public_html的ENV文件,類似下面:
[~/env] $
所以我輸入
$ ../bin/pserve production.ini,
然而,當我訪問www.mydomain.com時,它仍然顯示index.html。我應該如何解決這個問題?
我正在使用CentOS 64bit + Apache + mod_wsgi。
的設置如下:
Apache/2.2.24 (Unix)
mod_ssl/2.2.24
OpenSSL/1.0.0-fips
mod_wsgi/3.3
Python/2.6.6
mod_auth_passthrough/2.1
mod_bwlimited/1.4
FrontPage/5.0.2.2635 configured -- resuming normal operations
在我production.ini文件,它是作爲遵循
[app:main]
use = egg:ECommerce
reload_templates = false
debug_authorization = false
debug_notfound = false
debug_routematch = false
debug_templates = false
default_locale_name = en
mongodb.url = mongodb://my.ip.address
mongodb.db_name = mycart_demo
[filter:weberror]
use = egg:WebError#error_catcher
debug = false
;error_log =
;show_exceptions_in_wsgi_errors = true
;smtp_server = localhost
;error_email = [email protected]
;smtp_username = janitor
;smtp_password = "janitor's password"
;from_address = [email protected]
;error_subject_prefix = "Pyramid Error"
;smtp_use_tls =
;error_message =
#[pipeline:main]
#pipeline =
# weberror
# ECommerce
[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 8080
# Begin logging configuration
[loggers]
keys = root, ecommerce
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
[logger_ecommerce]
level = WARN
handlers =
qualname = ecommerce
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
# End logging configuration
我已經成功地推出了在生產但現在,它顯示出500內部服務器錯誤...
在Apache的error_log,它顯示:
[Sun Apr 07 23:17:47 2013] [alert] [client <ip_address>]
/home/vretnet9/public_html/.htaccess: WSGIScriptAlias not allowed here
於是我就提前來看看的.htaccess
的.htaccess
Options +ExecCGI
AddHandler cgi-script .cgi
AddHandler wsgi-script .wsgi
WSGIScriptAlias ECommerce /home/vretnet9/modwsgi/env/pyramid.wsgi
WSGIDaemonProcess root processes=5 threads=1 display-name=%{GROUP}
WSGIProcessGroup root
WSGIApplicationGroup %{GLOBAL}
我不知道它實際上應該正在調用.htaccess或scriptalias應該與我的.conf中的那個相同,它位於
項modwsgi.conf的內容如下:
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess pyramid user=vretnet9 group=vretnet9 threads=4 \
python-path=/home/vretnet9/modwsgi/env/lib/python3.3/site-packages
WSGIScriptAlias /ECommerce /home/vretnet9/modwsgi/env/pyramid.wsgi
<Directory /home/vretnet9/modwsgi/env>
WSGIProcessGroup pyramid
Order allow,deny
Allow from all
</Directory>
EDIT 在Apache的error_log,下面是被記錄:
[Mon Apr 08 02:17:22 2013] [error] Traceback (most recent call last):
[Mon Apr 08 02:17:22 2013] [error] File
"/home/vretnet9/modwsgi/env/pyramid.wsgi", line 5, in <module>
[Mon Apr 08 02:17:22 2013] [error] from pyramid.paster import get_app,
setup_logging
[Mon Apr 08 02:17:22 2013] [error] File "/home/vretnet9/modwsgi/env/
lib/python3.3/site-packages/pyramid/paster.py", line 1, in <module>
[Mon Apr 08 02:17:22 2013] [error] import os
[Mon Apr 08 02:17:22 2013] [error] ImportError: No module named os
EDIT#2
這是我在shell中運行時的結果:
[~/modwsgi/env]# python
Python 3.3.0 (default, Mar 27 2013, 09:31:49)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> print (os.getcwd())
/home/vretnet9/modwsgi/env
你不說已經安裝了哪些服務器。你應該試着弄清楚爲什麼nginx沒有運行。這可能是因爲您的其他服務器應用程序正在使用端口80.請檢查nginx的日誌。此外,一旦nginx的運行過程中,本文中的食譜可以幫助你http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/deployment/nginx.html – 2013-03-27 22:14:00
在你development.ini,哪個端口是你的應用程序設置運行?通常我不認爲它默認爲80.您可能必須停止默認網站(apache?)並將金字塔應用設置爲響應端口80?雖然,在我的生產服務器上,我相信它也使用nginix。 – 2013-03-28 01:43:54
我使用的Apache + mod_wsgi的 – Gino 2013-03-28 03:55:56