I am pretty new to django but experienced in Python and java web programming with different frameworks.
I have made myself a nice little django app, but I cant seem to make it match http://www.mysite.com as opposed to http://www.mysite.com/myapp.
I have defined urls and views in my urls.conf which is currently not decoupled from the app (don’t mind that).
urlpatterns = patterns('myapp.views',
(r'^myapp/$', 'index'),
(r'^myapp/(?P<some_id>\d+)/global_stats/$', 'global_stats'),
(r'^myapp/(?P<some_id>\d+)/player/(?P<player_id>\d+)/$', 'player_stats'),
)
All this works like a charm. If someone goes to http://www.mysite.com/myapp they will hit my index view which causes a http redirect to my “correct” default url.
So, how can I add a pattern that will do the same as (r’^myapp/$’, ‘index’) but without the /myapp–that is, http://www.mysite.com should suffice?
I would think this would be very basic stuff… I tried adding a line like:
(r'^$', 'index'),
however this throws me in a loop…
Hope you django gurus out there can clarify this for me!
This sounds strange.
Your latest attempt should work, but what I normally do – put
This scales better when you start adding new apps.