login community faq

What are the recommended settings for user-uploaded media? It seems like media (avatars, etc) should be served by the static app, but at least in my dev setup, MEDIA_ROOT/URL are distinct from STATIC_ROOT/URL. Locally, my media settings are:

1
2
3
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
MEDIA_ROOT = os.path.join(SITE_ROOT, 'media')
MEDIA_URL = ''

but when I try these settings on webfaction and I upload avatar pics, it looks like links are pointing somewhere valid and the files are uploaded to the server, but the images are showing broken link icons.

asked Apr 04 '12 at 17:45

sharkfin's gravatar image

sharkfin
175

This depends on the Django version - it sounds like your local application might be a different from the Django application version installed on WebFaction, and Django's settings.py files and static media configuration has changed considerably in recent versions.

Our documentation covers standard static media service for Django 1.4. For uploads, you should only need to add a single symbolic link to static-only application with extra_info pointing to the directory where your uploads are located, and then ensuring that the URL path where this new application is mounted is correct such that the URLs which your application is using route through the symbolic link application and are served via the front-end Nginx server.

If you'd like us to take a look at your setup, feel free to open a support ticket. We can then update this question with the correct answer once the issue has been solved completely.

(Apr 05 '12 at 03:00) ryans ♦♦ ryans's gravatar image

I fixed this by setting:

MEDIA_ROOT = STATIC_ROOT

MEDIA_URL = STATIC_URL

Thanks Ryan.

(Apr 05 '12 at 15:31) sharkfin sharkfin's gravatar image
Be the first one to answer this question!
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×643
×20

Asked: Apr 04 '12 at 17:45

Seen: 757 times

Last updated: Apr 05 '12 at 15:31

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited