我有一个使用pcreate创建的金字塔Fanstatic应用程序:
pcreate -s starter -s pyramid_fanstatic
如果我使用/bin/pserve fanstatic启动服务器,一切正常。但是,当我使用Apache WSGI模块加载应用程序时,一个链接如下:
^{pr2}$返回404 Apache未找到。在
这是我的WSGI应用程序:
import os
activate_this = os.path.join('/opt/services/services/bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
os.environ['PYTHON_EGG_CACHE'] = '/opt/services/python-eggs'
from pyramid.paster import get_app, setup_logging
ini_path = '/opt/services/services/development.ini'
setup_logging(ini_path)
application = get_app(ini_path, 'main')
这是我的Apache conf文件:
<VirtualHost *:80>
ServerAdmin a.orth@cgiar.org
ServerName data.ilri.org
# Pass authorization info on (needed for rest api).
WSGIPassAuthorization On
WSGIDaemonProcess services python-path=/opt/services/services display-name=services processes=2 threads=15
WSGIScriptAlias /services /opt/services/services/services/services.wsgi process-group=services application-group=%{GLOBAL}
<Location /services>
WSGIProcessGroup services
</Location>
ErrorLog /var/log/httpd/services.error.log
CustomLog /var/log/httpd/services.custom.log combined
</VirtualHost>
我可以看到/bin/pserve fanstatic在加载应用程序之前包含了我的资源目录:
"""A script aware of static resource"""
import pyramid.scripts.pserve
import pyramid_fanstatic
import os
dirname = os.path.dirname(__file__)
dirname = os.path.join(dirname, 'resources')
pyramid.scripts.pserve.add_file_callback(
pyramid_fanstatic.file_callback(dirname))
pyramid.scripts.pserve.main()
但即使我在我的初始pyApache找不到fanstatic资源。在
我还将此添加到我的ini文件中:
[filter:fanstatic]
use = egg:fanstatic#fanstatic
[pipeline:main]
pipeline = fanstatic services
我还应该检查/做什么?在
您似乎没有告诉Apache提供静态文件。参见:
修好了!!在
我不得不将这些行添加到[应用程序:主]公司名称:
根据文档:https://pypi.python.org/pypi/pyramid_fanstatic
相关问题 更多 >
编程相关推荐