I have a problem with my urls.py file in Django which allows me wherever to have access on my admin interface, wherever to load the images. If somebody could have a look over it, thanks in advance !
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
urlpatterns = patterns('',
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/', include(admin.site.urls)),
url(r'^admin/files/(?P<filepath>.*)$', 'my.app.admin.serv_backup_files', name='admin-file-serv'),
(r'^(?P<restaurant_slug>[^(admin)][a-zA-B-_0-9]+)$', TemplateView.as_view(template_name=os.path.join(settings.G_DOC_ROOT, 'index.html'))),
(r'^(?P<path>[^(admin)].*)$', 'django.views.static.serve', {'document_root': settings.G_DOC_ROOT}),
)
The problem is that with this configuration, I see on the console of the runserver, things like
"GET /img/field_bg.gif HTTP/1.1" 404
for all the images, that are supposed to be served statically.
I can remove the [^(admin)]
from the last pattern and the site will be served well, except that it will try to reroute the admin interface to the static file.
Thanks in advance for helping me combining the static file, the subdomainless TemplateViewing and the admin normal access.