I got really excited about this:
image_url = docs(id)('dog.jpg').url
... but when I try it I get:
'Database' object is not callable
...and same result when I try this:
image_url = docs(id)('_attachments')('dog.jpg').url
It's odd because I was able to do this previously, when the code was
just residing on my laptop, simply by doing:
pre_markdown_text = pre_markdown_text.replace('imagepath','http://
localhost:5984/docs/' + doc['title'] + '/')
text_marked_down = markdown.markdown(pre_markdown_text)
...then, when I passed 'text_marked_down' to the template it was able
to render the image perfectly well. But,
now that I've copied the code from my little laptop to the server, I
can't seem to find a way to make it work
(and obviously an image url with "localhost" in there will not do).
What's more surprising to me is that I'm not finding an example of
this anywhere on the web. When I am
trying to do something that's pretty ordinary (show an image in a web
page) and I'm finding no examples of
how to do it, I start to think that I have gone wrong somewhere.
Do others avoid using couchdb to serve up the images inside django (or
any other framework)? I would have
thought that using _attachments would be a great way to do it, but I'm
starting to wonder if I have picked
the wrong strategy here. Should I just be putting the images in
Django's "static" folder instead?
thanks,
ross