quantifiedcode / python-anti-patterns

An open collection of Python anti-patterns and worst practices.
https://quantifiedcode.github.io/python-anti-patterns
Other
1.71k stars 249 forks source link

MEDIA_URL and STATIC_URL #58

Closed Glueon closed 9 years ago

Glueon commented 9 years ago

I think there is a error in this section

MEDIA_URL and STATIC_URL point to the same folder.

""" settings.py """

# Media and static root are identical
STATIC_URL = 'http://www.mysite.com/static'
MEDIA_URL = 'http://www.mysite.com/media'

First of all they are not identical here.

Then in a best practice section you write:

Ensure, STATIC_URL and MEDIA_URL point to different folders.

""" settings.py """

STATIC_ROOT = '/path/to/my/static/files'
MEDIA_ROOT = '/path/to/my/media/files'

What it has to do with URL's? Probably should be:

Media and static root are identical
STATIC_URL = 'http://www.mysite.com/static'
MEDIA_URL = 'http://www.mysite.com/static'
...
# Ensure, STATIC_URL and MEDIA_URL point to different folders.
STATIC_URL = 'http://www.mysite.com/static'
MEDIA_URL = 'http://www.mysite.com/media'