| | 77 | |
|---|
| | 78 | Serving media files |
|---|
| | 79 | =================== |
|---|
| | 80 | |
|---|
| | 81 | Django doesn't serve media files itself. It'd be inefficient to flow media |
|---|
| | 82 | files through a (relatively) complex framework when much, much more well-tuned |
|---|
| | 83 | solutions are better. |
|---|
| | 84 | |
|---|
| | 85 | We recommend using a separate Web server for serving media. Here are some good |
|---|
| | 86 | choices: |
|---|
| | 87 | |
|---|
| | 88 | * lighttpd_ |
|---|
| | 89 | * TUX_ |
|---|
| | 90 | * A stripped-down version of Apache_ |
|---|
| | 91 | |
|---|
| | 92 | If, however, you have no option but to serve media files on the same Apache |
|---|
| | 93 | ``VirtualHost`` as Django, here's how you can turn off mod_python for a |
|---|
| | 94 | particular part of the site:: |
|---|
| | 95 | |
|---|
| | 96 | <Location "/media/"> |
|---|
| | 97 | SetHandler None |
|---|
| | 98 | </Location> |
|---|
| | 99 | |
|---|
| | 100 | Just change ``Location`` to the root URL of your media files. |
|---|
| | 101 | |
|---|
| | 102 | .. _lighttpd: http://www.lighttpd.net/ |
|---|
| | 103 | .. _TUX: http://en.wikipedia.org/wiki/TUX_web_server |
|---|
| | 104 | .. _Apache: http://httpd.apache.org/ |
|---|