Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.3.X] Fixed #15974 -- Correctly link to static files handling in de…

…ployment docs. Thanks, RogueBean.

Backport from trunk (r16491).

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@16492 bcc190cf-cafb-0310-a4f2-bffc1f526a37
commit 5a0787f904945e2d1b18b65389b6f76a98b36bf5 1 parent a441032
Jannis Leidel authored July 01, 2011
40  docs/howto/deployment/modpython.txt
@@ -246,9 +246,9 @@ Django -- for serving media. Here are some good choices:
246 246
     * A stripped-down version of Apache_
247 247
     * Cherokee_
248 248
 
249  
-If, however, you have no option but to serve media files on the same Apache
250  
-``VirtualHost`` as Django, here's how you can turn off mod_python for a
251  
-particular part of the site::
  249
+If, however, you have no option but to serve media or static files on the
  250
+same Apache ``VirtualHost`` as Django, here's how you can turn off mod_python
  251
+for a particular part of the site::
252 252
 
253 253
     <Location "/media">
254 254
         SetHandler None
@@ -257,9 +257,9 @@ particular part of the site::
257 257
 Just change ``Location`` to the root URL of your media files. You can also use
258 258
 ``<LocationMatch>`` to match a regular expression.
259 259
 
260  
-This example sets up Django at the site root but explicitly disables Django for
261  
-the ``media`` subdirectory and any URL that ends with ``.jpg``, ``.gif`` or
262  
-``.png``::
  260
+This example sets up Django at the site root but explicitly disables Django
  261
+for the ``media`` and ``static`` subdirectories and any URL that ends with
  262
+``.jpg``, ``.gif`` or ``.png``::
263 263
 
264 264
     <Location "/">
265 265
         SetHandler python-program
@@ -271,11 +271,14 @@ the ``media`` subdirectory and any URL that ends with ``.jpg``, ``.gif`` or
271 271
         SetHandler None
272 272
     </Location>
273 273
 
  274
+    <Location "/static">
  275
+        SetHandler None
  276
+    </Location>
  277
+
274 278
     <LocationMatch "\.(jpg|gif|png)$">
275 279
         SetHandler None
276 280
     </LocationMatch>
277 281
 
278  
-
279 282
 .. _lighttpd: http://www.lighttpd.net/
280 283
 .. _Nginx: http://wiki.nginx.org/Main
281 284
 .. _TUX: http://en.wikipedia.org/wiki/TUX_web_server
@@ -285,22 +288,21 @@ the ``media`` subdirectory and any URL that ends with ``.jpg``, ``.gif`` or
285 288
 Serving the admin files
286 289
 =======================
287 290
 
288  
-Note that the Django development server automagically serves admin media files,
289  
-but this is not the case when you use any other server arrangement. You're
290  
-responsible for setting up Apache, or whichever media server you're using, to
291  
-serve the admin files.
  291
+Note that the Django development server automagically serves the static files
  292
+of the admin app, but this is not the case when you use any other server
  293
+arrangement. You're responsible for setting up Apache, or whichever media
  294
+server you're using, to serve the admin files.
292 295
 
293  
-The admin files live in (:file:`django/contrib/admin/media`) of the Django
294  
-distribution.
  296
+The admin files live in (:file:`django/contrib/admin/static/admin`) of the
  297
+Django distribution.
295 298
 
296  
-Here are two recommended approaches:
  299
+We **strongly** recommend using :mod:`django.contrib.staticfiles` to handle
  300
+the admin files, but here are two other approaches:
297 301
 
298  
-    1. Create a symbolic link to the admin media files from within your
299  
-       document root. This way, all of your Django-related files -- code **and**
300  
-       templates -- stay in one place, and you'll still be able to ``svn
301  
-       update`` your code to get the latest admin templates, if they change.
  302
+    1. Create a symbolic link to the admin static files from within your
  303
+       document root.
302 304
 
303  
-    2. Or, copy the admin media files so that they live within your Apache
  305
+    2. Or, copy the admin static files so that they live within your Apache
304 306
        document root.
305 307
 
306 308
 Using "eggs" with mod_python
50  docs/howto/deployment/modwsgi.txt
@@ -55,12 +55,12 @@ just below the ``import sys`` line to place your project on the path. Remember t
55 55
 replace 'mysite.settings' with your correct settings file, and '/path/to/mysite'
56 56
 with your own project's location.
57 57
 
58  
-.. _serving-media-files:
  58
+.. _serving-files:
59 59
 
60  
-Serving media files
61  
-===================
  60
+Serving files
  61
+=============
62 62
 
63  
-Django doesn't serve media files itself; it leaves that job to whichever Web
  63
+Django doesn't serve files itself; it leaves that job to whichever Web
64 64
 server you choose.
65 65
 
66 66
 We recommend using a separate Web server -- i.e., one that's not also running
@@ -76,22 +76,29 @@ If, however, you have no option but to serve media files on the same Apache
76 76
 ``VirtualHost`` as Django, you can set up Apache to serve some URLs as
77 77
 static media, and others using the mod_wsgi interface to Django.
78 78
 
79  
-This example sets up Django at the site root, but explicitly serves ``robots.txt``,
80  
-``favicon.ico``, any CSS file, and anything in the ``/media/`` URL space as a static
81  
-file. All other URLs will be served using mod_wsgi::
  79
+This example sets up Django at the site root, but explicitly serves
  80
+``robots.txt``, ``favicon.ico``, any CSS file, and anything in the
  81
+``/static/`` and ``/media/`` URL space as a static file. All other URLs
  82
+will be served using mod_wsgi::
82 83
 
83 84
     Alias /robots.txt /usr/local/wsgi/static/robots.txt
84 85
     Alias /favicon.ico /usr/local/wsgi/static/favicon.ico
85 86
 
86 87
     AliasMatch ^/([^/]*\.css) /usr/local/wsgi/static/styles/$1
87 88
 
88  
-    Alias /media/ /usr/local/wsgi/static/media/
  89
+    Alias /media/ /usr/local/wsgi/media/
  90
+    Alias /static/ /usr/local/wsgi/static/
89 91
 
90 92
     <Directory /usr/local/wsgi/static>
91 93
     Order deny,allow
92 94
     Allow from all
93 95
     </Directory>
94 96
 
  97
+    <Directory /usr/local/wsgi/media>
  98
+    Order deny,allow
  99
+    Allow from all
  100
+    </Directory>
  101
+
95 102
     WSGIScriptAlias / /usr/local/wsgi/scripts/django.wsgi
96 103
 
97 104
     <Directory /usr/local/wsgi/scripts>
@@ -105,8 +112,8 @@ file. All other URLs will be served using mod_wsgi::
105 112
 .. _Apache: http://httpd.apache.org/
106 113
 .. _Cherokee: http://www.cherokee-project.com/
107 114
 
108  
-More details on configuring a mod_wsgi site to serve static files can be found
109  
-in the mod_wsgi documentation on `hosting static files`_.
  115
+.. More details on configuring a mod_wsgi site to serve static files can be found
  116
+.. in the mod_wsgi documentation on `hosting static files`_.
110 117
 
111 118
 .. _hosting static files: http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#Hosting_Of_Static_Files
112 119
 
@@ -115,22 +122,21 @@ in the mod_wsgi documentation on `hosting static files`_.
115 122
 Serving the admin files
116 123
 =======================
117 124
 
118  
-Note that the Django development server automagically serves admin media files,
119  
-but this is not the case when you use any other server arrangement. You're
120  
-responsible for setting up Apache, or whichever media server you're using, to
121  
-serve the admin files.
  125
+Note that the Django development server automagically serves the static files
  126
+of the admin app, but this is not the case when you use any other server
  127
+arrangement. You're responsible for setting up Apache, or whichever media
  128
+server you're using, to serve the admin files.
122 129
 
123  
-The admin files live in (:file:`django/contrib/admin/media`) of the Django
124  
-distribution.
  130
+The admin files live in (:file:`django/contrib/admin/static/admin`) of the
  131
+Django distribution.
125 132
 
126  
-Here are two recommended approaches:
  133
+We **strongly** recommend using :mod:`django.contrib.staticfiles` to handle
  134
+the admin files, but here are two other approaches:
127 135
 
128  
-    1. Create a symbolic link to the admin media files from within your
129  
-       document root. This way, all of your Django-related files -- code **and**
130  
-       templates -- stay in one place, and you'll still be able to ``svn
131  
-       update`` your code to get the latest admin templates, if they change.
  136
+    1. Create a symbolic link to the admin static files from within your
  137
+       document root.
132 138
 
133  
-    2. Or, copy the admin media files so that they live within your Apache
  139
+    2. Or, copy the admin static files so that they live within your Apache
134 140
        document root.
135 141
 
136 142
 Details
2  docs/howto/static-files.txt
@@ -337,7 +337,7 @@ serving your site, the basic outline gets modified to look something like:
337 337
     * On the server, run :djadmin:`collectstatic` to copy all the static files
338 338
       into :setting:`STATIC_ROOT`.
339 339
     * Point your web server at :setting:`STATIC_ROOT`. For example, here's
340  
-      :ref:`how to do this under Apache and mod_wsgi <serving-media-files>`.
  340
+      :ref:`how to do this under Apache and mod_wsgi <serving-files>`.
341 341
 
342 342
 You'll probably want to automate this process, especially if you've got
343 343
 multiple web servers. There's any number of ways to do this automation, but
4  docs/ref/contrib/admin/index.txt
@@ -46,8 +46,8 @@ Other topics
46 46
 
47 47
 .. seealso::
48 48
 
49  
-    For information about serving the media files (images, JavaScript, and CSS)
50  
-    associated with the admin in production, see :ref:`serving-media-files`.
  49
+    For information about serving the static files (images, JavaScript, and
  50
+    CSS) associated with the admin in production, see :ref:`serving-files`.
51 51
 
52 52
 ``ModelAdmin`` objects
53 53
 ======================

0 notes on commit 5a0787f

Please sign in to comment.
Something went wrong with that request. Please try again.