问题与mod_wsgi的部署Django应用程序 [英] Problem with deploying django application on mod_wsgi

查看:126
本文介绍了问题与mod_wsgi的部署Django应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎有一个问题,Django的部署与mod_wsgi的。在过去,我已经使用mod_python的,但我想作出改变。我一直在使用格雷厄姆邓普尔顿注意到这里的http:// code.google.com / p / modwsgi /维基/ IntegrationWithDjango 1 ,但似乎仍然无法正常工作。我得到一个内部服务器错误。

django.wsgi文件:

 导入OS
进口SYSsys.path.append('的/ var / www / html等')
sys.path.append('的/ var / www / html等/ c2duo_crm')os.environ ['DJANGO_SETTINGS_MODULE'] ='c2duo_crm.settings'
进口django.core.handlers.wsgi
应用= django.core.handlers.wsgi.WSGIHandler()WSGIScriptAlias​​ / /var/www/html/c2duo_crm/apache/django.wsgi

的Apache httpd的文件:

 <目录/ var / www / html等/ c2duo_crm /阿帕奇>
为了允许,拒绝
所有允许
< /目录>

在我的Apache的错误日志,它说我有这样的错误这还不是全部的,但我已经得到了最重要的部分:

  [错误13]权限被拒绝:'/.python-eggs
[周四年3月3 14点59分25秒2011] [错误] [客户端127.0.0.1]
[周四年3月3 14点59分25秒2011] [错误] [客户端127.0.0.1] Python的鸡蛋缓存目录当前设置为:
[周四年3月3 14点59分25秒2011] [错误] [客户端127.0.0.1]
[周四年3月3 14点59分25秒2011] [错误] [客户端127.0.0.1] /.python-eggs
[周四3月3日14点59分25秒2011] [错误] [客户端127.0.0.1]
[周四年3月3 14点59分25秒2011] [错误] [客户端127.0.0.1]也许你的帐户不具有此目录的写入权限?您可以
[周四3月3日14点59分25秒2011] [错误] [客户端127.0.0.1]通过设置PYTHON_EGG_CACHE环境改变缓存目录
[周四3月3日14点59分25秒2011] [错误] [客户端127.0.0.1]变量指向一个访问的目录。


解决方案

Python的鸡蛋 s为所包含zip文件中的模块文件。 Python的鸡蛋缓存就是Python的把它们提取出来,使其能够运行它们的目录。您正在试图提取他们/.python-eggs,但你不必要么目录的写访问,或者/如果它不存在。

您有两种选择,你可以创建/.python-eggs和(被Apache作为运行的用户或者至少写的),使其可写,也可以设置PYTHON_EGG_CACHE(使用的 WSGIPythonEggs指令)到你有写权限的目录

I seem to have a problem deploying django with mod_wsgi. In the past I've used mod_python but I want to make the change. I have been using Graham Dumpleton notes here http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango1, but it still seem to not work. I get a Internal Server Error.

django.wsgi file:

import os
import sys

sys.path.append('/var/www/html')
sys.path.append('/var/www/html/c2duo_crm')

os.environ['DJANGO_SETTINGS_MODULE'] = 'c2duo_crm.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

WSGIScriptAlias / /var/www/html/c2duo_crm/apache/django.wsgi

Apache httpd file:

<Directory /var/www/html/c2duo_crm/apache>
Order allow,deny
Allow from all
</Directory>

In my apache error log, it says I have this error This is not all of it, but I've got the most important part:

[Errno 13] Permission denied: '/.python-eggs'
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1]
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1] The Python egg cache directory is currently set to:
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1]
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1]   /.python-eggs
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1]
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1] Perhaps your account does not have write access to this directory?  You can
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1] change the cache directory by setting the PYTHON_EGG_CACHE environment
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1] variable to point to an accessible directory.

解决方案

Python Eggs are module files that are contained within zip files. The Python Egg Cache is the directory where Python extracts them so it can run them. Currently you are trying to extract them to /.python-eggs but you don't have write access to either that directory, or to / if it doesn't exist.

You have two options, you can either create /.python-eggs and make it world writable (or at least writable by the user Apache is running as), or you can set PYTHON_EGG_CACHE (using the WSGIPythonEggs directive) to a directory where you do have write access.

这篇关于问题与mod_wsgi的部署Django应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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