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燈, 水草

請輸入看板名稱,例如:BuyTogether站內搜尋

TOP