I was looking to try django-directupload in one of my Django projects, but I'm new to Django and having some trouble with installation. I'm following the installation instructions in the README. I installed django-directupload using sudo pip install django-directupload
.
Here is my urls.py, which I don't think is right:
from django.conf.urls.defaults import patterns, include, url
from testproject import settings
import directupload
from django.contrib import admin
directupload.admin.patch_admin()
admin.autodiscover()
urlpatterns = patterns('testproject.database.views',
url(r'^(\d+)/$', 'test_view', name="test_page"),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^directupload/', include(directupload.urls))
)
if settings.DEBUG:
urlpatterns += patterns('',
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT,
}),
)
Edit:
So I've gained some insight into overriding admin templates (Thanks ilvar for the link). I copied and pasted the contrib/admin/templates/admin/change_form.html
file into the project templates directory in the /admin/nameofmyapp/
subdirectory, and added {% load directupload_tags %}{% directupload_head %}
below the rest of the load tags. When I go to the Django admin I get the exception: 'module' object has no attribute 'admin'
on line 6 of urls.py
.