Py学习  »  Django

帮我看看我的apache+django配置有什么问题

andyhaolly • 11 年前 • 3339 次点击  

一:我在/var/www/example.net/public_html/目录下用

django-admin.py startproject mysite

命令新建project之后,目录是:

└── mysite
    ├── manage.py
    ├── mysite
    │   ├── __init__.py
    │   ├── __init__.pyc
    │   ├── settings.py
    │   ├── settings.pyc
    │   ├── urls.py
    │   └── wsgi.py
    └── polls
        ├── __init__.py
        ├── models.py
        ├── tests.py
        └── views.py

我的的/ect/apache2/site-enabled/example.net文件配置如下:

    <VirtualHost *:80>
        ServerAdmin webmaster@example.net
        ServerName  example.net
        ServerAlias www.example.net
        DocumentRoot /var/www/example.net/public_html/mysite/
        ErrorLog /var/www/example.net/logs/error.log
        CustomLog /var/www/example.net/logs/access.log combined

        <Directory /var/www/example.net/public_html/mysite/mysite>
        <Files wsgi.py>
        Order allow,deny
        Allow from all
        </Files>
        </Directory>

        WSGIScriptAlias / /var/www/example.net/public_html/mysite/mysite/wsgi.py
        #WSGIPythonPath /var/www/example.net/public_html/mysite

    </VirtualHost>

那个wsgi.py 文件是django 创建的,里面是:

    """
    WSGI config for mysite project.

    This module contains the WSGI application used by Django's development server
    and any production WSGI deployments. It should expose a module-level variable
    named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
    this application via the ``WSGI_APPLICATION`` setting.

    Usually you will have the standard Django WSGI application here, but it also
    might make sense to replace the whole Django WSGI application with a custom one
    that later delegates to the Django one. For example, you could introduce WSGI
    middleware here, or combine a Django application with an application of another
    framework.

    """
    import os

# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use
# os.environ["DJANGO_SETTINGS_MODULE"] = "mysite.settings"
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")

# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
    from django.core.wsgi import get_wsgi_application
    application = get_wsgi_application()

# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)

我在/var/www/example.net/public_html/mysite 和/var/www/example.net/public_html/mysite/mysite 下面放置了index.html 文件,重启apache后都没有显示。

提示:Internal Server Error

哪里出错了?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/265
 
3339 次点击  
文章 [ 1 ]  |  最新文章 11 年前
Py站长
Reply   •   1 楼
Py站长    11 年前

用nginx吧,别用apache了