Prefix 'MEDIA_' is a little bit misleading. MEDIA_* stuff is for uploaded
files (FileField and ImageField). MEDIA_ROOT specifies a directory where you
want to put uploaded files. MEDIA_URL is how to access them from browser.
Basically it boils down to these steps:
1) Create a directory for uploaded files. Example: /home/yourname/myuploads/
2) Specify MEDIA_ROOT in your settings.py: MEDIA_ROOT =
'/home/yourname/myuploads/'
3) Map it in your web server to URL you want. Example: you can access these
files using
http://site.my/upload/
4) Specify MEDIA_URL in your settings.py: MEDIA_URL =
'
http://site.my/upload/'
As you can see you can easily use a different web server on different
computer to serve your uploaded files --- it's great for scalability.
Obviously in this case you should use some network file sharing.
This is what I do for #3 using Apache:
a) I made a symbolic link from my web site directory to the upload
directory: ln -s /home/name/upload upload
b) I modified .htaccess file adding: RewriteRule ^(upload/.*)$ - [L]
Now when I browse to this directory (
http://lazutkin.com/upload/) I can see
files I have here (you can turn off directory browsing later). I don't need
Django to serve this directory --- it's done by Apache. But I need to tell
Django how to put files there (MEDIA_ROOT) and how to form urls to show
these files (MEDIA_URL). So file is going to be saved as MEDIA_ROOT/abc.txt
and it's going to be accessed as MEDIA_URL/abc.txt.
I hope it helps,
Eugene
"David S." <
david...@alumni.tufts.edu> wrote in message
news:loom.2005102...@post.gmane.org...