如何从.htaccess修改sys.path以允许mod_python看到Django? [英] How do I modify sys.path from .htaccess to allow mod_python to see Django?

查看:152
本文介绍了如何从.htaccess修改sys.path以允许mod_python看到Django?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑托管Django网站的主机已安装mod_python,但没有Django。 Django的INSTALL文件表明我可以简单地将django目录复制到Python的site-packages目录中来安装Django,所以我怀疑可以通过修改sys来配置Python / mod_python来寻找其他地方(即我的用户空间)。路径,但我不知道如何从.htaccess或mod_python更改它。



如何修改 sys.path .htaccess 允许mod_python看到Django?



PS我只能通过FTP访问网站(即没有shell访问)。我知道这听起来像是我应该切换主机,但是有一些引人注目的理由让我做这个工作,所以我至少要去尝试。

解决方案

根据Django的 ticket#2255 ,您需要管理员访问权限到httpd.conf以使用Django与mod_python,这不会改变,所以你可能在水中死亡。要解决如何从 .htaccess 修改 sys.path 的基本问题,可以使用 PythonPath 指令在 .htaccess


The host I'm considering for hosting a Django site has mod_python installed, but does not have Django. Django's INSTALL file indicates that I can simply copy the django directory to Python's site-packages directory to install Django, so I suspect that it might be possible to configure Python / mod_python to look for it elsewhere (namely my user space) by modifying sys.path, but I don't know how to change it from .htaccess or mod_python.

How do I modify sys.path from .htaccess to allow mod_python to see Django?

P.S. I can only access the site via FTP (i.e. no shell access). I realize that it sounds like I should just switch hosts, but there are compelling reasons for me to make this work so I'm at least going to try.

解决方案

According to ticket #2255 for Django, you need admin access to httpd.conf in order to use Django with mod_python, and this is not going to change, so you may be dead in the water. To answer the basic question of how to modify sys.path from .htaccess, you can use the PythonPath directive in .htaccess.

这篇关于如何从.htaccess修改sys.path以允许mod_python看到Django?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆