ichbindev wrote:
> I am trying to write urlconf file so that there is an index or home
> page. If none of the patterns match, it should, by default, go to that
> page. For example, a sample urlconf could be
> 
> urlpatterns = patterns('',
>     (r'^time/$', current_datetime),
>     (r'^time/plus/(\d{1,2})/$', hours_ahead),
> )
> 
> If the user enters http://www.example.com/time/ they are handled by
> that pattern. But there are two scenarios I am interested in:
> 
> (a) the user types http://www.example.com/
> (b) the user types http://www.example.com/somethingelse/


a)  (r'^$', the_default_root_view)

   def the_default_root_view(request):
     return render_to_response('home.html')

b)  (r'^(.*)$', unhandled_path_view)

   def unhandled_path_view(request, path):
     do_something_with(path.split('/'))
     return render_to_response(...)


Just make sure (a) comes before (b) in your urls.py file. 
Actually, make sure *everything else* comes before (b) in your 
urls.py file :)

-tim



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to