0

我正在尝试在 AWS EC2 上托管一个 django 应用程序以用于学习目的(在 ubuntu-8.04.3 上)。我在请求时收到“ It Workshttp://ec2-x-x-x-x.compute-1.amazonaws.com ”消息 但我没有得到管理页面。以下是我遵循的步骤:

网址.py:

from django.conf.urls.defaults import *
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
    (r'^admin/',include('django.contrib.admin.urls')),
)

设置.py:

INSTALLED_APPS=(
    'django.contrib.auth',
    'django.contrib.contenttypes'
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin'
)

mysite 配置: 位置:/etc/apache2/sites-enabled

<VirtualHost *:80>
    ServerAdmin admin@mysite.com
    ServerName  mysite.com
    DocumentRoot /home/demo/mysite

    Alias /static /home/demo/mysite/template/static/
    <Directory /home/demo/mysite/template/static>
        Order deny,allow
        Allow from all
    </Directory>

    Alias /media /home/demo/mysite/media/
    <Directory /home/demo/mysite/media>
        Order allow,deny
        Allow from all
    </Directory>

    WSGIScriptAlias / /home/demo/mysite/mysite.wsgi
    <Directory /home/demo/mysite>
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined
</VirtualHost>

mysite.wsgi: 位置:/home/demo/mysite/

import os, sys

sys.path.append('home/demo/mysite')
os.environ['DJANG0_SETTINGS_MODULE']='mysite.settings'

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

syncdb顺利。但是我在请求时没有得到管理页面,http://ec2-x-x-x-x.compute-1.amazonaws.com/admin尽管它包含在INSTALLED_APPSand中URLS.py。我哪里错了?我收到The requested URL /admin was not found on this server.消息了。

4

1 回答 1

0

拼写错误:

  <VirualHost *:80>

假设您剪切并粘贴了该代码。您可能应该运行那个方便的 apache 实用程序来检查您的配置文件是否有错误,或者读取 apache 日志文件。

于 2013-01-08T08:32:27.007 回答