A very django meandering

I’m currently trying to get http://www.lightbird.net/dbe/photo.html this tutorial to work.  I’ve succeeded in getting the basics to display, except for the images!  Which of course is a bit silly, since that is the whole point of the tutorial.  So far I’ve discovered that firefox seems to like things being served in html as file://localhost/[your local location of file] but I understand that this is bad coding practice; it is far better to keep paths relative.

Even so, when I tried to directly reference an image in django I found that the html parsed correctly in firefox, even that which was generated, but did not on the django server!  This has caused me some puzzlement.  Currently I am investigating the suggestion (at the original page) and also backed up by a comment (with zero upvotes) at stackoverflow here: http://stackoverflow.com/questions/2443752/django-display-image-in-admin-interface in order to see if modification of the base admin template might work.

My development environment is eclipse.

UPDATE: Turns out that the problem was with my urls.py file.


#… import statements…

from tutorial3_lightbird.settings import MEDIA_ROOT

urlpatterns = patterns(”,
#… ,
(r’^media/(?P<path>.*)$’, ‘django.views.static.serve’,{‘document_root’: MEDIA_ROOT}),

Turns out that I was using the MEDIA_URL value from settings.py before.  Rookie mistake.

Tags: , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: