我正在尝试在 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_APPS
and中URLS.py
。我哪里错了?我收到The requested URL /admin was not found on this server.
消息了。