django models - how to connect a python code to the server? -


i have function in views.py print string. have run local server django. wrote code.the page of project must show word "hello world" , doesn't! me fix it?

from django.conf.urls.defaults import * mysite.views import hello  # uncomment next 2 lines enable admin: # django.contrib import admin # admin.autodiscover()  urlpatterns = patterns('',     ('^hello/$', hello), # examples: # url(r'^$', 'mysite.views.home', name='home'), # url(r'^mysite/', include('mysite.foo.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)), ) 

judging have , receiving 404 not found presume going localhost:8000

however url setup says should go localhost:8000/hello/ (you have no page set index pattern url(r'^$', hello) )

you need follow correct syntax in urls. have:

('^hello/$', hello), 

you need have:

url(r'^hello/$', hello), 

you can enable more verbose debugging going settings.py file , setting debug = true


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -