trying to add an image to an EB post

13 views
Skip to first unread message

Cromulent

unread,
May 9, 2012, 9:35:47 AM5/9/12
to Django FeinCMS
So for the first time I'm trying to add a media file - a JPG to be
specific - to an EB post. I successfully added it via the Entry admin
screen and followed it up with another piece of RichText. I verified
that the pic was successfully uploaded to my host at

/public_html/mysite/media/medialibrary/2012/05/myimage.jpg

But the pic is not showing up on the site properly. The image url in
the html source is

http://www.mysite.net/medialibrary/2012/05/myimage.jpg

I feel like there must be an entry somewhere in the main settings.py
that I need to set properly. Help?


Dave

Cromulent

unread,
May 9, 2012, 9:55:18 AM5/9/12
to Django FeinCMS
I should add that I do believe I have the right definitions set up:

--------------
from feincms.content.richtext.models import RichTextContent
from feincms.content.medialibrary.v2 import MediaFileContent
from elephantblog.models import Entry

Entry.register_regions(('main', 'Main'),) # original

Entry.create_content_type(RichTextContent) # original

Entry.create_content_type(MediaFileContent, TYPE_CHOICES=(
('default', 'default'),
))
-------------------

The blog post itself is rendering fine. Its just that the url for the
image isn't going to work; I think what it needs to look like is

http://www.mysite.net/media/medialibrary/2012/05/myimage.jpg

instead of

http://www.mysite.net/medialibrary/2012/05/myimage.jpg

and that is why I suspect there is something in my settings.py that I
need to set.


Dave

Marc Tamlyn

unread,
May 9, 2012, 10:15:20 AM5/9/12
to django-...@googlegroups.com
Sounds to me like the MEDIA_URL isn't being passed into your context. You'll want this ('django.core.context_processors.static',) in your CONTEXT_PROCESSORS.

Marc



Dave

--
You received this message because you are subscribed to the Google Groups "Django FeinCMS" group.
To post to this group, send email to django-...@googlegroups.com.
To unsubscribe from this group, send email to django-feincm...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-feincms?hl=en.


Cromulent

unread,
May 9, 2012, 10:27:16 AM5/9/12
to Django FeinCMS
Here is what I've currently got:

TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.contrib.messages.context_processors.messages",

"django.core.context_processors.request",
)

Cromulent

unread,
May 9, 2012, 10:36:04 AM5/9/12
to Django FeinCMS
Additionally I have these settings:

MEDIA_ROOT = '/home/myname/public_html/mysite/media/'
MEDIA_URL = 'http://www.mysite.net/media'



Dave
Reply all
Reply to author
Forward
0 new messages