Python 板


LINE

小弟是个django新手, 是的, 现在才进行到 Writing your first Django app, part 2 http://docs.djangoproject.com/en/1.3/intro/tutorial02/ 关於Tutorial 1 的每个步骤都完成了, 也无错误讯息或结果与预期不同.. 但不知为何 part2 的 admin 网页一直有问题.. 多次尝试後, 发现只要将 urls.py 的 #url(r'^admin/', include(admin.site.urls)), 这行 uncomment 後, 即便是连首页也有会错误 ==== 错误讯息如下 ==== Page not found (404) Request Method: GET Request URL: http://localhost:8000/ Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order: ^admin/ The current URL, , didn't match any of these. You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page. ====================== 小弟使用的是 Windows 7, Python 2.7, Django 1.3 Try & Google 了一晚, 还是找不出原因... 卡关了. 希望板上的高手可以指点迷津... 谢谢! --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.43.215.183
1F:→ aquarianboy:你的urls.py长什麽样子呢? 04/02 11:12
试到最後, 我把tutorial上的整个贴过去了, 还是不行.. :XD ==== 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'^mysite/', include('mysite.foo.urls')), # Uncomment the admin/doc line below and add 'django.contrib.admindocs' # to INSTALLED_APPS 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)), ) ==== 早上又试了一些, 还是不 work... 所以我决定先跳过 Part 2 但我发现 Part 3 一些新增的网页都可以正常的回应... 就唯独 http://127.0.0.1/admin 这一个页面还是 ==== DoesNotExist at /admin/ Site matching query does not exist. Request Method: GET Request URL: http://localhost:8000/admin/ Django Version: 1.3 Exception Type: DoesNotExist Exception Value: Site matching query does not exist. Exception Location: D:\Python27\lib\site-packages\django\db\models\query.py in get, line 349 Python Executable: D:\Python27\python.exe Python Version: 2.7.0 Python Path: ['E:\\Work\\Python\\website\\mysite', 'C:\\Windows\\system32\\python27.zip', 'D:\\Python27\\DLLs', 'D:\\Python27\\lib', 'D:\\Python27\\lib\\plat-win', 'D:\\Python27\\lib\\lib-tk', 'D:\\Python27', 'D:\\Python27\\lib\\site-packages', 'D:\\Python27\\lib\\site-packages\\win32', 'D:\\Python27\\lib\\site-packages\\win32\\lib', 'D:\\Python27\\lib\\site-packages\\Pythonwin', 'D:\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode'] Server time: Sat, 2 Apr 2011 12:00:01 +0800 ==== 请问我是不是某个环境变数, 或是路径设定上有问题呢? 我看 part 2 里说的, 理论上 admin 会自己找到对应的 default 位置的 html? 谢谢! ※ 编辑: skiff 来自: 114.43.187.1 (04/02 12:01)
2F:→ skiff:做完part3, 对urlpatterns比较清楚... 感觉问题好像出在 04/02 12:47
3F:→ skiff:include(admin.site.urls) ... 04/02 12:48
4F:→ csieJer:Python Path里面没有django, 所以找不到admin? 04/04 17:23
5F:→ csieJer:不是上面的问题, 不过把预设的Site删掉也会有你的问题~ 04/04 18:22
6F:推 csieJer:syncdb 没跑到? 04/04 18:26
7F:→ skiff:在IDLE里, import django 是OK的.. 04/06 19:51
8F:→ skiff:syncdb确认有跑完, 没有错误讯息. 请问预设Site删掉是指? 04/06 19:52







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Tech_Job站内搜寻

TOP