Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django 1.3: MEDIA_URL vs. STATIC_URL

Tags:

django-1.3

What does MEDIA_URL does now? I am particularly confused after I got "django.core.exceptions.ImproperlyConfigured: The MEDIA_URL and STATIC_URL settings must have different values".

I'd appreciate Django explaining why this is. Regards

like image 914
Zain Khan Avatar asked Dec 16 '11 07:12

Zain Khan


3 Answers

MEDIA_URL is used to point to the base URL for user-generated content - uploaded images, files, that sort of thing.

STATIC_URL is used as the prefix for JavaScript, CSS, etc.

like image 58
Zain Khan Avatar answered Oct 30 '22 13:10

Zain Khan


The answer doesn't explain the reasoning as to why.

One of the nice things about Django is that it doesn't expose the backend via the url. Example: /formmail.pl /search.php

But, when it comes to static files, I guess that doesn't matter.

Very disappointing...

like image 36
idbill Avatar answered Oct 30 '22 15:10

idbill


Have a look at note number 2 on this page. There they explain why.

https://docs.djangoproject.com/en/dev/howto/static-files/

like image 42
vonGohren Avatar answered Oct 30 '22 14:10

vonGohren