在apache + ubuntu 10.10上部署django应用程序

时间:2012-09-22 17:26:33

标签: python django linux apache ubuntu

我有一个Django只是你好世界的Web应用程序运行良好 python manage.py runserver。此应用程序具有以下目录结构

/var/www/helloworld,其中包含manage.py

/var/www/helloworld/helloworld包含settings.pyurls.pywsgi.py

/var/www/helloworld/app包含views.py

现在我想在我的机器上的apache服务器上托管这个应用程序,当我在浏览器中打开localhost时显示it works

我的apache配置文件位于/etc/apache2/apache2.conf,此文件末尾包含sites-enabled目录(位于/etc/apache2/)。此目录site-enabled包含一个文件default,其中包含以下内容

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

    <Location "/myapp">
        SetHandler python-program
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE helloworld.settings
        PythonPath "['/var/www/helloworld'] + sys.path"
    </Location>

</VirtualHost>

我已在此文件中添加了该位置标记,然后我重新启动了apache服务器,当我在浏览器中打开localhost / myapp时,它给出了500个内部服务器错误以及以下内容 `服务器遇到内部错误或配置错误,无法完成您的请求。

请与服务器管理员webmaster @ localhost联系,告知他们错误发生的时间,以及可能导致错误的任何操作。

服务器错误日志中可能会提供有关此错误的更多信息。

我试过了 Error while deploying Django on Apache Deploying django app on Apache mod_python

但现在条件是我要把头撞到墙上(这就是为什么我在这里发布了所有内容)

我真的很感谢任何帮助。

由于

0 个答案:

没有答案
相关问题