mirror of https://github.com/django/django.git
Fixed a few docstrings and other helper texts in the staticfiles app.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15148 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
39b3269fec
commit
465833834c
|
@ -17,7 +17,6 @@ _finders = {}
|
||||||
class BaseFinder(object):
|
class BaseFinder(object):
|
||||||
"""
|
"""
|
||||||
A base file finder to be used for custom staticfiles finder classes.
|
A base file finder to be used for custom staticfiles finder classes.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def find(self, path, all=False):
|
def find(self, path, all=False):
|
||||||
"""
|
"""
|
||||||
|
@ -62,7 +61,7 @@ class FileSystemFinder(BaseFinder):
|
||||||
|
|
||||||
def find(self, path, all=False):
|
def find(self, path, all=False):
|
||||||
"""
|
"""
|
||||||
Looks for files in the extra media locations
|
Looks for files in the extra locations
|
||||||
as defined in ``STATICFILES_DIRS``.
|
as defined in ``STATICFILES_DIRS``.
|
||||||
"""
|
"""
|
||||||
matches = []
|
matches = []
|
||||||
|
@ -76,7 +75,7 @@ class FileSystemFinder(BaseFinder):
|
||||||
|
|
||||||
def find_location(self, root, path, prefix=None):
|
def find_location(self, root, path, prefix=None):
|
||||||
"""
|
"""
|
||||||
Find a requested static file in a location, returning the found
|
Finds a requested static file in a location, returning the found
|
||||||
absolute path (or ``None`` if no match).
|
absolute path (or ``None`` if no match).
|
||||||
"""
|
"""
|
||||||
if prefix:
|
if prefix:
|
||||||
|
@ -100,7 +99,8 @@ class FileSystemFinder(BaseFinder):
|
||||||
|
|
||||||
class AppDirectoriesFinder(BaseFinder):
|
class AppDirectoriesFinder(BaseFinder):
|
||||||
"""
|
"""
|
||||||
A static files finder that looks in the ``media`` directory of each app.
|
A static files finder that looks in the directory of each app as
|
||||||
|
specified in the source_dir attribute of the given storage class.
|
||||||
"""
|
"""
|
||||||
storage_class = AppStaticStorage
|
storage_class = AppStaticStorage
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ class AppDirectoriesFinder(BaseFinder):
|
||||||
|
|
||||||
def find_in_app(self, app, path):
|
def find_in_app(self, app, path):
|
||||||
"""
|
"""
|
||||||
Find a requested static file in an app's media locations.
|
Find a requested static file in an app's static locations.
|
||||||
"""
|
"""
|
||||||
storage = self.storages[app]
|
storage = self.storages[app]
|
||||||
prefix = storage.get_prefix()
|
prefix = storage.get_prefix()
|
||||||
|
@ -207,16 +207,10 @@ class DefaultStorageFinder(BaseStorageFinder):
|
||||||
|
|
||||||
def find(path, all=False):
|
def find(path, all=False):
|
||||||
"""
|
"""
|
||||||
Find a requested static file, first looking in any defined extra media
|
Find a static file with the given path using all enabled finders.
|
||||||
locations and next in any (non-excluded) installed apps.
|
|
||||||
|
|
||||||
If no matches are found and the static location is local, look for a match
|
|
||||||
there too.
|
|
||||||
|
|
||||||
If ``all`` is ``False`` (default), return the first matching
|
If ``all`` is ``False`` (default), return the first matching
|
||||||
absolute path (or ``None`` if no match). Otherwise return a list of
|
absolute path (or ``None`` if no match). Otherwise return a list.
|
||||||
found absolute paths.
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
matches = []
|
matches = []
|
||||||
for finder in get_finders():
|
for finder in get_finders():
|
||||||
|
@ -237,7 +231,7 @@ def get_finders():
|
||||||
|
|
||||||
def _get_finder(import_path):
|
def _get_finder(import_path):
|
||||||
"""
|
"""
|
||||||
Imports the message storage class described by import_path, where
|
Imports the staticfiles finder class described by import_path, where
|
||||||
import_path is the full Python path to the class.
|
import_path is the full Python path to the class.
|
||||||
"""
|
"""
|
||||||
module, attr = import_path.rsplit('.', 1)
|
module, attr = import_path.rsplit('.', 1)
|
||||||
|
|
|
@ -16,8 +16,7 @@ class Command(NoArgsCommand):
|
||||||
"""
|
"""
|
||||||
option_list = NoArgsCommand.option_list + (
|
option_list = NoArgsCommand.option_list + (
|
||||||
make_option('--noinput', action='store_false', dest='interactive',
|
make_option('--noinput', action='store_false', dest='interactive',
|
||||||
default=True, help="Do NOT prompt the user for input of any "
|
default=True, help="Do NOT prompt the user for input of any kind."),
|
||||||
"kind."),
|
|
||||||
make_option('-i', '--ignore', action='append', default=[],
|
make_option('-i', '--ignore', action='append', default=[],
|
||||||
dest='ignore_patterns', metavar='PATTERN',
|
dest='ignore_patterns', metavar='PATTERN',
|
||||||
help="Ignore files or directories matching this glob-style "
|
help="Ignore files or directories matching this glob-style "
|
||||||
|
@ -69,7 +68,7 @@ Are you sure you want to do this?
|
||||||
|
|
||||||
Type 'yes' to continue, or 'no' to cancel: """)
|
Type 'yes' to continue, or 'no' to cancel: """)
|
||||||
if confirm != 'yes':
|
if confirm != 'yes':
|
||||||
raise CommandError("Static files build cancelled.")
|
raise CommandError("Collecting static files cancelled.")
|
||||||
|
|
||||||
# Use ints for file times (ticket #14665)
|
# Use ints for file times (ticket #14665)
|
||||||
os.stat_float_times(False)
|
os.stat_float_times(False)
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Command(BaseRunserverCommand):
|
||||||
make_option('--insecure', action="store_true", dest='insecure_serving', default=False,
|
make_option('--insecure', action="store_true", dest='insecure_serving', default=False,
|
||||||
help='Allows serving static files even if DEBUG is False.'),
|
help='Allows serving static files even if DEBUG is False.'),
|
||||||
)
|
)
|
||||||
help = "Starts a lightweight Web server for development, including static files serving."
|
help = "Starts a lightweight Web server for development and also serves static files."
|
||||||
|
|
||||||
def get_handler(self, *args, **options):
|
def get_handler(self, *args, **options):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -9,7 +9,7 @@ from django.contrib.staticfiles import utils
|
||||||
|
|
||||||
class StaticFilesStorage(FileSystemStorage):
|
class StaticFilesStorage(FileSystemStorage):
|
||||||
"""
|
"""
|
||||||
Standard file system storage for site media files.
|
Standard file system storage for static files.
|
||||||
|
|
||||||
The defaults for ``location`` and ``base_url`` are
|
The defaults for ``location`` and ``base_url`` are
|
||||||
``STATIC_ROOT`` and ``STATIC_URL``.
|
``STATIC_ROOT`` and ``STATIC_URL``.
|
||||||
|
@ -22,7 +22,7 @@ class StaticFilesStorage(FileSystemStorage):
|
||||||
if not location:
|
if not location:
|
||||||
raise ImproperlyConfigured("You're using the staticfiles app "
|
raise ImproperlyConfigured("You're using the staticfiles app "
|
||||||
"without having set the STATIC_ROOT setting. Set it to "
|
"without having set the STATIC_ROOT setting. Set it to "
|
||||||
"the absolute path of the directory that holds static media.")
|
"the absolute path of the directory that holds static files.")
|
||||||
# check for None since we might use a root URL (``/``)
|
# check for None since we might use a root URL (``/``)
|
||||||
if base_url is None:
|
if base_url is None:
|
||||||
raise ImproperlyConfigured("You're using the staticfiles app "
|
raise ImproperlyConfigured("You're using the staticfiles app "
|
||||||
|
|
Loading…
Reference in New Issue