django - Recompile Python code on Raspberry Pi? -
i know might sound dummy question i'd know if python code needs recompiled or that's done (binding / rendering) server handles python code?
i'm asking because i've started sample project , while adding link page got "page not found" (404 error)
using urlconf defined in httpi.urls, django tried these url patterns, in order: ^$ ^piface/ current url, mypage.html, didn't match of these. you're seeing error because have debug = true in django settings file. change false, , django display standard 404 page.
and python code looks like:
from django.conf.urls import patterns, include, url django.conf import settings # uncomment next 2 lines enable admin: # django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', url(r'^$', 'httpi.views.index'), url(r'^/mypage.html', 'httpi.views.index'), url(r'^piface/', include('httpiface.urls')), # uncomment admin/doc line below enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # uncomment next line enable admin: # url(r'^admin/', include(admin.site.urls)), )
try changing url(r'^/mypage.html', 'httpi.views.index'),
url(r'^mypage.html/$', 'httpi.views.index'),
.
the regex looks has additional starting slash , guess that's what's throwing off. error message says not recognize url typed in , helpfully points out valid response @ 1 of other specified urls. alternatively, according routing showed here, if typed in no page beyond base server url (likely http://localhost:8000/
), take same view 1 specified @ mypage.html.
Comments
Post a Comment