从django 1.3更新到1.4时,apache 500内部错误

时间:2012-07-24 13:32:17

标签: django django-1.3 django-1.4 django-wsgi

最初当我在我的ubuntu服务器上安装了带有wsgi的Django 1.3时,我使用了包含的setup.py文件,所以当我想通过重命名“django”文件夹时,按照安装指南的Remove any old versions of Django部分进行更新我的site-packages“django.old”,然后使用Django 1.4的setup.py文件安装新版本

重新启动我的apache服务器后,我收到了标准的500内部错误。我检查了apache错误日志,发现ADMIN_MEDIA_PREFIX已被弃用,所以在Django 1.4 release notes之后我从设置文件中删除了ADMIN_MEDIA_PREFIX,并将管理文件移动到静态目录下的一个名为“admin”的文件夹下。

我再次重新启动了我的apache服务器并收到了相同的标准500错误,但这次我尝试在apache错误日志上运行尾部时没有注册新的错误。

没有任何进一步的错误消息我真的被卡住了所以任何帮助将不胜感激。

以下是我的apache站点配置文件和wsgi文件的内容

网站配置:

<VirtualHost *:80>
    ServerAdmin me@mysite.com
    ServerName  www.mysite.com
    ServerAlias mysite.com

    # Indexes + Directory Root.
    # DirectoryIndex index.html index.htm index.php
    DocumentRoot /home/www/www.mysite.com/htdocs/

    # CGI Directory
    ScriptAlias /cgi-bin/ /home/www/www.mysite.com/cgi-bin/
    <Location /cgi-bin>
            Options +ExecCGI
    </Location>

    # Logfiles
    ErrorLog  /home/www/www.mysite.com/logs/error.log
    CustomLog /home/www/www.mysite.com/logs/access.log combined

    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /home/www/www.mysite.com/htdocs/>
            Options FollowSymLinks MultiViews
            AllowOverride All
           allow from all
    </Directory>

    ### Connect Django to the URL using WSGI (the django recommended method)
    WSGIScriptAlias /myproject /django/myproject/django.wsgi

    ### Alias to the location of the static dir (images, css, js etc.)
    Alias /myproject/static /django/myproject/static
    <Directory /django/myproject/static>
            Order deny,allow
            allow from all
    </Directory>
</VirtualHost>

django.wsgi:

import sys
import os
import django.core.handlers.wsgi

sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'

application = django.core.handlers.wsgi.WSGIHandler()

sys.path.insert(0, '/django/myproject/')
sys.path.insert(0, '/django/myproject/')

from django.core.handlers.wsgi import WSGIHandler

application = WSGIHandler()

请注意我出于安全原因尝试从这些文件中删除或重命名任何标识信息,因此如果出现明显的语法错误等,则可能是由于此编辑。这些文件的原始版本与名称更改相同,并且在Django 1.3下运行良好

1 个答案:

答案 0 :(得分:0)

django 1.4包含一个wsgi.py文件配置:

参见文档: https://docs.djangoproject.com/en/1.4/howto/deployment/wsgi/#the-application-object