什么可能导致 Pylons 的重定向循环? uWSGI +切罗基?
我对 Django + uWSGI + Cherokee 没有任何问题。但我想在致力于任一框架之前尝试一下 pylons。
我按照 pylonshq.com - 1.0/gettingstarted 的教程进行操作,
在使用粘贴运行 pylons 时没有遇到任何问题。
因此,我使用了来自projects.unbit.it - uwsgi/wiki/UsePaste 的 uWSGI 指令来运行塔架
这是我与 Cherokee 一起使用的源解释器行(连接 127.0.0.1:5000):
uwsgi -s 127.0.0.1:5000 --paste config:/var/www/pylons/example/development.ini -H /var/www/pylons/ -M
My vServer in Cherokee is bokken.test.com与根目录: /var/www/pylons/example/example/public (我尝试过带或不带尾部斜杠)
我的“Directory /”规则处理程序设置为uWSGI源,但没有为特定处理程序设置根目录。
当我访问 bokken.test.com 时,出现重定向循环错误。
Google Chrome:
The webpage at http://bokken.test.com// has resulted in too many redirects (Notice the extra slash).
Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.
Error.log:
*** Starting uWSGI 0.9.5.4 (32bit) on [Sat Aug 7 19:01:51 2010] ***
compiled with version: 4.4.3
Python version: 2.6.5 (r265:79063, Apr 16 2010, 13:28:26)
[GCC 4.4.3]
your memory page size is 4096 bytes
allocated 372 bytes (0 KB) for 1 request's buffer.
Setting PythonHome to /var/www/pylons/...
binding on TCP port: 5000
your server socket listen backlog is limited to 64 connections
initializing hooks...done.
Loading paste environment: config:/var/www/pylons/example/development.ini
application 0 (/) ready
setting default application to 0
spawned uWSGI master process (pid: 1278)
spawned uWSGI worker 1 (pid: 1280)
[pid: 1280|app: 0|req: 1/1] 192.168.0.198 () {52 vars in 926 bytes} [Sat Aug 7 19:01:55 2010] GET / => generated 433 bytes in 7 msecs (HTTP/1.1 301) 2 headers in 95 bytes (0 async switches on async core 0)
与 Django 不同,我发现的教程都没有指定 uwsgi.xml 或 .wsgi 脚本。 我不确定需要改变什么。
I had no issue with Django + uWSGI + Cherokee. BUt I would like to try pylons before committing to either framework.
I followed the tutorial from pylonshq.com - 1.0/gettingstarted
I ran into no problems when running pylons with paste.
So I used instructions to run pylons with uWSGI from projects.unbit.it - uwsgi/wiki/UsePaste
This is the source interpreter line I used with Cherokee (connection 127.0.0.1:5000):
uwsgi -s 127.0.0.1:5000 --paste config:/var/www/pylons/example/development.ini -H /var/www/pylons/ -M
My vServer in Cherokee is bokken.test.com with root directory:
/var/www/pylons/example/example/public
(I've tried with and without trailing slash)
My "Directory /" rule handler is set to the uWSGI source, but no root directory is set for the specific handler.
When I visit bokken.test.com, I get a redirect loop error.
Google Chrome:
The webpage at http://bokken.test.com// has resulted in too many redirects (Notice the extra slash).
Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.
Error.log:
*** Starting uWSGI 0.9.5.4 (32bit) on [Sat Aug 7 19:01:51 2010] ***
compiled with version: 4.4.3
Python version: 2.6.5 (r265:79063, Apr 16 2010, 13:28:26)
[GCC 4.4.3]
your memory page size is 4096 bytes
allocated 372 bytes (0 KB) for 1 request's buffer.
Setting PythonHome to /var/www/pylons/...
binding on TCP port: 5000
your server socket listen backlog is limited to 64 connections
initializing hooks...done.
Loading paste environment: config:/var/www/pylons/example/development.ini
application 0 (/) ready
setting default application to 0
spawned uWSGI master process (pid: 1278)
spawned uWSGI worker 1 (pid: 1280)
[pid: 1280|app: 0|req: 1/1] 192.168.0.198 () {52 vars in 926 bytes} [Sat Aug 7 19:01:55 2010] GET / => generated 433 bytes in 7 msecs (HTTP/1.1 301) 2 headers in 95 bytes (0 async switches on async core 0)
Unlike Django, none of the tutorials I found specify a uwsgi.xml or .wsgi script.
I'm not sure what needs to change.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您说您已将 Cherokee vServer 的文件根设置为 Pylons 项目的 /example/public 目录。这似乎可能是一个问题 - Pylons 在尝试匹配控制器之前会在公共目录中查找要提供的文件,因此您要为将来的问题做好准备。 Pylons 应用程序的根文件夹可能应该是您将虚拟服务器指向的位置,并让 Pylons 处理自己的目录树块。
另外,您肯定需要一个 .wsgi 脚本 - 您问题的最后一点意味着您没有一个?这有点令人困惑 - 请澄清一下。
You say that you've set the file root of the Cherokee vServer to the /example/public directory of your Pylons project. That seems likely to be a problem - Pylons looks in the public directory for files to serve before attempting to match a controller, so you're setting yourself up for future issues there. The root folder of the Pylons app should probably be where you point the vServer at, and let Pylons handle its own chunk of the directory tree.
Also, you will definitely need a .wsgi script - the last bit of your question implies that you don't have one? It's a little confusing - please clarify.