看板 Python 關於我們 聯絡資訊
這是我的資料夾結構 mysite/ manage.py db.sqlite3 mysite/ __init__.py settings.py urls.py wsgi.py __pycache__/ __init__.cpython-34.pyc settings.cpython-34.pyc urls.cpython-34.pyc wsgi.cpython-34.pyc polls/ __init__.py admin.py apps.py migrations/ __init__.py models.py tests.py views.py 我把polls 移往下一層(mysite內)執行後 ----cmd 顯示---- (myvenv) C:\Users\peng\Django>python .\mysite\manage.py runserver Performing system checks... System check identified no issues (0 silenced). June 18, 2017 - 19:38:53 Django version 1.11.2, using settings 'mysite.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK. -----瀏覽器顯示---- Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/ Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order: ^polls/ ^admin/ The empty path 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. -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.167.50.89 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1497786964.A.94A.html
a0919610611: url 沒匹配到呀 去 127.0.0.1:8000/polls 看看 06/18 20:16
a0919610611: 錯誤訊息蠻清楚的 06/18 20:16
djshen: 教學明明是寫Go to http://localhost:8000/polls/ 06/18 20:19
djshen: 別照抄都抄錯了 06/18 20:20
a0919610611: 可以學一下regular expression 06/18 20:21
coauglant: 謝謝djshen,不過還是不知道為什麼要移到下一層才能動 06/18 20:32
coauglant: 如果直接startapp polls 還要移動到下一層才能用 06/18 20:43
coauglant: 有點奇怪,不知道是哪邊出了問題? 06/18 20:44
coauglant: a大 我會去學一下的 謝謝 06/18 20:45
uranusjr: 因為你執行 startapp 的位置就錯了, 應該要在 manage.py 06/18 21:00
uranusjr: 那層執行才對, 不是在外面執行 06/18 21:01
coauglant: 要怎麼設定呢?因為照著步驟走就出現在那個位置上 06/18 21:27
uranusjr: 不需要怎麼設定啊, 就 cd 進去 manage.py 那層再下指令 06/18 21:33
uranusjr: 你之後的所有指令也都應該在那層執行才對啊 06/18 21:33
coauglant: 十分感謝,剛剛重做一次很順利的完成 06/18 21:40
jack123218: 指令是打manage.py 就要在manage.py那層的路徑才能執 06/18 22:05
jack123218: 行 06/18 22:05