mirror of
https://github.com/django/django.git
synced 2025-07-05 18:29:11 +00:00
[1.3.X] Fixed #15681 -- Fixed a documentation error regarding the default value of the STATIC_URL setting. Thanks, Chris Drackett.
Backport from trunk (r15913 and r15914). git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@15966 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
6bf0fe6c4e
commit
e6fe336f10
@ -48,16 +48,24 @@ Here's the basic usage in a nutshell:
|
|||||||
See the documentation for the :setting:`STATICFILES_FINDERS` setting for
|
See the documentation for the :setting:`STATICFILES_FINDERS` setting for
|
||||||
details on how ``staticfiles`` finds your files.
|
details on how ``staticfiles`` finds your files.
|
||||||
|
|
||||||
2. Make sure that ``django.contrib.staticfiles`` is in your
|
2. Set the :setting:`STATIC_URL` setting to the URL you want to use
|
||||||
|
for pointing to your static files, e.g.::
|
||||||
|
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
|
||||||
|
In projects freshly created with the :djadmin:`startproject`
|
||||||
|
management command this will be preset to ``'/static/'``.
|
||||||
|
|
||||||
|
3. Make sure that ``django.contrib.staticfiles`` is in your
|
||||||
:setting:`INSTALLED_APPS`.
|
:setting:`INSTALLED_APPS`.
|
||||||
|
|
||||||
For :ref:`local development<staticfiles-development>`, if you are using
|
For :ref:`local development<staticfiles-development>`, if you are using
|
||||||
:ref:`runserver<staticfiles-runserver>` or adding
|
:ref:`runserver<staticfiles-runserver>` or adding
|
||||||
:ref:`staticfiles_urlpatterns<staticfiles-development>` to your URLconf,
|
:ref:`staticfiles_urlpatterns<staticfiles-development>` to your URLconf,
|
||||||
you're done! Your static files will automatically be served at the
|
you're done! Your static files will automatically be served at the
|
||||||
default :setting:`STATIC_URL` of ``/static/``.
|
:setting:`STATIC_URL` you specified in step 2.
|
||||||
|
|
||||||
3. You'll probably need to refer to these files in your templates. The
|
4. You'll probably need to refer to these files in your templates. The
|
||||||
easiest method is to use the included context processor which will allow
|
easiest method is to use the included context processor which will allow
|
||||||
template code like:
|
template code like:
|
||||||
|
|
||||||
@ -70,24 +78,20 @@ Here's the basic usage in a nutshell:
|
|||||||
|
|
||||||
When you're ready to move out of local development and deploy your project:
|
When you're ready to move out of local development and deploy your project:
|
||||||
|
|
||||||
1. Set the :setting:`STATIC_URL` setting to the public URL for your static
|
1. Set the :setting:`STATIC_ROOT` setting to point to where you'd like your
|
||||||
files (in some cases, the default value of ``/static/`` may still be
|
|
||||||
fine).
|
|
||||||
|
|
||||||
2. Set the :setting:`STATIC_ROOT` setting to point to where you'd like your
|
|
||||||
static files collected to when you use the :djadmin:`collectstatic`
|
static files collected to when you use the :djadmin:`collectstatic`
|
||||||
management command. For example::
|
management command. For example::
|
||||||
|
|
||||||
STATIC_ROOT = "/home/jacob/projects/mysite.com/sitestatic"
|
STATIC_ROOT = "/home/jacob/projects/mysite.com/sitestatic"
|
||||||
|
|
||||||
3. Run the :djadmin:`collectstatic` management command::
|
2. Run the :djadmin:`collectstatic` management command::
|
||||||
|
|
||||||
./manage.py collectstatic
|
./manage.py collectstatic
|
||||||
|
|
||||||
This'll churn through your static file storage and copy them into the
|
This'll churn through your static file storage and copy them into the
|
||||||
directory given by :setting:`STATIC_ROOT`.
|
directory given by :setting:`STATIC_ROOT`.
|
||||||
|
|
||||||
4. Deploy those files by configuring your webserver of choice to serve the
|
3. Deploy those files by configuring your webserver of choice to serve the
|
||||||
files in :setting:`STATIC_ROOT` at :setting:`STATIC_URL`.
|
files in :setting:`STATIC_ROOT` at :setting:`STATIC_URL`.
|
||||||
|
|
||||||
:ref:`staticfiles-production` covers some common deployment strategies
|
:ref:`staticfiles-production` covers some common deployment strategies
|
||||||
|
Loading…
x
Reference in New Issue
Block a user