Django urls problem:It works! ... You're seeing this message because you have DEBUG = True in your D

From:http://stackoverflow.com/questions/4172650/django-admin-page-not-showing

5
down vote
favorite
1
I've been following the polls tutorial up until the point where I should have a login page for the admin backend. http://docs.djangoproject.com/en/dev/intro/tutorial02/ 

Instead I get the welcome page like this:

It works! ... You're seeing this message because you have DEBUG = True in your Django settings file and you haven't configured any URLs. Get to work!
I have enabled the admin app in INSTALLED_APPS, synced the db and tweaked urls.py so I'm not sure what the problem is.

Running apache2 with mod_wsgi.

urls.py: from 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)),
)
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'
)
...
Tables:

Database changed

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                 |
+----------------------------+
python django mod-wsgi
share|improve this question
asked Nov 13 '10 at 13:09

Keyo
3,42563059
 	
Switching to django webserver since apache is giving me some issues. The admin page 404's and the It worked page is no longer blue. –  Keyo Nov 13 '10 at 13:25 
4 Answers
activeoldestvotes
up vote
3
down vote
accepted
Are these two lines really indented one space, as appears in your post?

 from django.contrib import admin
 admin.autodiscover()
You'll get an IndentationError if you do that. Put them flush against the left margin.

Later: Oh I see in a comment above that you found this indentation error. Marking my answer as community wiki.

share|improve this answer
answered Nov 13 '10 at 23:12

community wiki
hughdbrown
 	
Well spotted. By the way what is the general consensus on indentation, do I tab or use spaces? Tabs seems easier. –  Keyo Nov 14 '10 at 7:20
1	  	
@Keyo: The general consensus is to use four spaces. I prefer tabs, too: you can get your editor to display a tab as however many spaces you want. People say, "But what if you mix leading tabs and spaces!?!?!??! No tabs!!!" Anyway, if I ran the world, we'd all use tabs. YMMV. –  hughdbrown Nov 15 '10 at 15:31


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值