Exactly.

Perhaps we should just ignore MEDIA and STATIC variable setup in the
settings file altogether. When I couldn't get the variables to work like how
I thought they should work, I just put the following stuff in the Apache
vhost config file:

Alias /media /Users/eiji/Sites/assets/media
Alias /static /Users/eiji/Sites/assets/static
Alias /admin/media/
/Library/Python/2.6/site-packages/django/contrib/admin/media/

But the problem is then I have to always use Apache even during development,
and I can't use Django's built-in web server.

It seems very repetitive to have to set:
MEDIA_ROOT = '/path/to/mymedia'
MEDIA_URL = '/media/'
in the settings file, then add almost the same thing to the Apache conf
file, and, in the case of STATIC, I also have to set the STATICFILES_DIRS
again with almost the same things.

Hmmm...

Eiji

On Fri, May 13, 2011 at 11:21 PM, km <[email protected]> wrote:

> Hi,
>
> On Sat, May 14, 2011 at 10:24 AM, Shawn Milochik <[email protected]>wrote:
>
>> Did you read the docs?
>> http://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/
>>
>> To use the staticfiles app you need to not only put the right things in
>> settings.py, but also run manage.py collectstatic to gather up all your
>> static content, then rsync/copy/whatever that content to the proper location
>> on your server so that the stuff you put in settings.py is valid.
>>
>> Same thing for media, to some extent (no 'collectstatic' analog). Django's
>> not going to serve your media or your static content in production. That's
>> going to be up to your Web server (Apache/nginx/lighttpd/whatever), and
>> setting that up properly is your job. It's way outside of the scope of
>> Django to do this for you.
>>
>> If django is not going to serve media in production and we totally depend
> on webserver to do that then what is the point in having variables such as
> MEDIA  and STATIC ?
>
> Probably, one can setup -static media- on the webserver which could be
> accessed as www.url/media and thus refer to this relative path as /media in
> templates instead of {{MEDIA}} or {{STATIC}}; which is much simpler than
> meddling with STATIC or MEDIA variables. Isnt it ?
>
> KM
>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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

Reply via email to