python-如何使金字塔应用程序在Apache mod_wsgi上运行
作者:互联网
我试图按照有关如何在apache mod_wsgi上运行金字塔应用程序的基本教程进行操作,但遇到了很多麻烦.
这是我正在关注的教程:
http://docs.pylonsproject.org/projects/pyramid/en/1.0-branch/tutorials/modwsgi/index.html
我正在已安装apache和mod_wsgi的centos计算机上进行本教程.
我认为我遇到的问题与httpd.conf文件有关.我将URL http://nodeline.com指向服务器,因此我尝试配置虚拟主机,以便在您访问nodeline.com时加载金字塔应用程序.
这就是我的httpd.conf文件中的内容.
<VirtualHost *:80>
ServerName nodeline.com
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess pyramid user=main group=main processes=1 \
threads=4 \
python-path=/home/main/modwsgi/env/lib/python2.6/site-packages
WSGIScriptAlias /myapp /home/main/modwsgi/env/pyramid.wsgi
<Directory /home/main/modwsgi/env>
WSGIProcessGroup pyramid
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
该教程很奇怪,因为它似乎正在教您如何在本地计算机上进行设置.它没有说关于那里的虚拟主机的任何信息.我有什么想念的吗?或者,也许有人可以将我指向正确的方向.我真的很感谢某人的帮助.
解决方法:
WSGIScriptAlias /myapp /home/main/modwsgi/env/pyramid.wsgi
应该
WSGIScriptAlias / /home/main/modwsgi/env/pyramid.wsgi
尝试这个:
<VirtualHost *:80>
ServerName nodeline.com
DocumentRoot /home/main/modwsgi/env
<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
</Directory>
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess pyramid user=main group=main processes=1 \
threads=4 \
python-path=/home/main/modwsgi/env/lib/python2.6/site-packages
WSGIScriptAlias / /home/main/modwsgi/env/pyramid.wsgi
<Directory /home/main/modwsgi/env>
WSGIProcessGroup pyramid
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
$sudo a2ensite pyramid
$sudo a2dissite默认
$sudo /etc/init.d/apache2重新启动
标签:apache,mod-wsgi,pyramid,python 来源: https://codeday.me/bug/20191123/2065085.html