python 2.7 - Django URL defaults to undefined location -
i created first django project, when go localhost address (http://127.0.0.1:8000), redirects http://127.0.0.1:8000/catalog , gives page not found @ /catalog/ 404 error. based on code i've written, expected go /index. catalog url not defined anywhere in project, , word appears in of associated files. here's relevant code:
urls.py:
from django.views.generic import redirectview urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^index/', include('portal.urls')), url(r'^$', redirectview.as_view(url='/index/', permanent=true)), ] + static(settings.static_url, document_root=settings.static_root) portal/urls.py:
from . import views urlpatterns = [ url(r'^$', views.indexview.as_view(), name='index'), url(r'^portal/(?p<pk>\d+)$', views.mapview.as_view(), name='portal'), ] i have been using chrome browser this. when tried on firefox, worked correctly (i.e. when typed in http://127.0.0.1:8000 redirected /index/). regardless of browser, if go 127.0.0.1:8000/index appears should.
the thing can think of create problem went through mdn django tutorial did use catalog url, deleted history chrome involved localhost, problem persists. seems should work regardless of history or cookies, anyways.
what part of code isn't strong enough override browser history, cookies, or whatever creating problem? (i'm new django, let me know if more code snippets useful).
Comments
Post a Comment