Django管理页面没有显示

Key*_*eyo 5 python django mod-wsgi

我一直在关注民意调查教程,直到我应该有一个管理员后端的登录页面.http://docs.djangoproject.com/en/dev/intro/tutorial02/

相反,我得到这样的欢迎页面:

我试图访问管理页面

我在INSTALLED_APPS中启用了管理员应用程序,同步数据库并调整了urls.py所以我不确定问题是什么.

用mod_wsgi运行apache2.

urls.py:来自django.conf.urls.defaults import*

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

urlpatterns = patterns('',
    # Example:
    # (r'^testproject/', include('testproject.foo.urls')),

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

    # Uncomment the next line to enable the admin:
     (r'^admin/', include(admin.site.urls)),
)
Run Code Online (Sandbox Code Playgroud)

Settings.py:

...
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    # Uncomment the next line to enable the admin:
     'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
     'django.contrib.admindocs',
     'polls'
)
...
Run Code Online (Sandbox Code Playgroud)

表:

数据库已更改

mysql> SHOW TABLES;
+----------------------------+
| Tables_in_django_test      |
+----------------------------+
| auth_group                 |
| auth_group_permissions     |
| auth_message               |
| auth_permission            |
| auth_user                  |
| auth_user_groups           |
| auth_user_user_permissions |
| django_admin_log           |
| django_content_type        |
| django_session             |
| django_site                |
| polls_choice               |
| polls_poll                 |
+----------------------------+
Run Code Online (Sandbox Code Playgroud)

hug*_*own 5

这两行是否真的缩进了一个空格,如帖子中所示?

 from django.contrib import admin
 admin.autodiscover()
Run Code Online (Sandbox Code Playgroud)

如果你这样做,你会得到一个IndentationError.将它们与左边距齐平.


后来:哦,我在上面的评论中看到你发现了这个缩进错误.将我的答案标记为社区维基.