4

我只是安装 apache 和 django。

django 默认页面工作正常:

有用!

这是此服务器的默认网页。

Web 服务器软件正在运行,但尚未添加任何内容。

但 /admin/ 站点不是:

未找到

在此服务器上找不到请求的 URL /admin/。

Apache/2.2.17 (Ubuntu) 服务器位于 69.162.92.53 端口 80

Apache conf (/etc/init.d/apache2/sites-avaliable/mysite.conf) 文件:

<VirtualHost *:80>
WSGIScriptAlias / /var/www/mysite/mysite/wsgi.py

ServerName mysite.com.br
Alias /static /var/www/mysite/media/static/

<Directory /var/www/mysite/mysite>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

wsgi 文件(/var/www/mysite/mysite/wsgi.py):

import os
import sys

sys.path.insert(0, '/var/www/mysite')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Django mysite.settings (/var/www/mysite/mysite/settings.py):

...
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)
...

Django mysite.urls (/var/www/mysite/mysite/urls.py):

from django.conf.urls import patterns, include, url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'mysite.views.home', name='home'),
    # url(r'^mysite/', include('mysite.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
)

就这样。我错过了什么吗?

谢谢!

4

1 回答 1

2

这是一个 apache 配置错误。

我相信您应该指出:-

<Directory /var/www/mysite>
    Order allow,deny
    Allow from all
</Directory>
于 2012-11-30T02:06:15.907 回答