Url rewrite for django ajax site in dev server -


i'm developing ajax site routing controlled javascript.
want every request sent indexview except declared in urls.py file.
here urls.py configuration:

urlpatterns = patterns('',     url(r'^api/', include('api.urls')),     url(r'^admin/', include(admin.site.urls)),     url(r'^$', indexview.as_view()), ) 

if change regex url(r'^', indexview.as_view()) works files in media_root won't displayed.
know in production can config server serve static files way want want work dev server.

silly solution. adding url(r'^', indexview.as_view()) after,

if settings.debug:     urlpatterns += patterns('',         (r'%s(?p<path>.*)' % settings.media_url[1:], 'django.views.static.serve', {'document_root': settings.media_root}),     ) 

did job. i'm open better ways managing routing kind of ajax applications.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -