0
我認爲這是一個長時間盯着代碼的情況,但是我無法獲取這個URL來解決。我正在使用Django 1.5.5。Django URL無法解析
這裏的主要urls.py
:
from django.conf.urls import patterns, include, url
from django.views.generic import RedirectView
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', RedirectView.as_view(url='/swap/')),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^swap/$', include('apps.swap.urls')),
url(r'^admin/swap/', include('apps.swap.admin_urls')),
url(r'^admin/', include(admin.site.urls)),
)
這裏是我的應用程序的url.py
:
from django.conf.urls import patterns, url
from apps.swap.views import About
urlpatterns = patterns('apps.swap.views',
url(r'^$', 'index'),
url(r'^about/$', About.as_view()),
)
所有URL解析(包括/swap/
),除了/swap/about/
。它只是拒絕解決。這是我看到的:
Using the URLconf defined in urlconf, Django tried these URL patterns, in this order:
1. ^__debug__/sql_select/$ [name='sql_select']
2. ^__debug__/sql_explain/$ [name='sql_explain']
3. ^__debug__/sql_profile/$ [name='sql_profile']
4. ^__debug__/template_source/$ [name='template_source']
5. ^$
6. ^admin/doc/
7. ^swap/$
8. ^admin/swap/
9. ^admin/
The current URL, swap/about/, didn't match any of these.
我在這裏錯過了什麼?我知道這很簡單,但昨天晚上16小時的編碼彎曲後,我覺得我已經失明瞭。
達赫,謝謝!我知道它必須是這樣愚蠢的東西! – Geoff