WebFaction
Community site: login 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:

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 04 Apr '12, 17:45

sharkfin
27159
accept rate: 0%

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.

(05 Apr '12, 03:00) ryans ♦♦

I fixed this by setting:

MEDIA_ROOT = STATIC_ROOT

MEDIA_URL = STATIC_URL

Thanks Ryan.

(05 Apr '12, 15:31) sharkfin
Be the first one to answer this question!
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

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×905
×26

question asked: 04 Apr '12, 17:45

question was seen: 2,988 times

last updated: 05 Apr '12, 15:31

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM