<commit_before>===================
The staticfiles app
===================

.. module:: django.contrib.staticfiles
   :synopsis: An app for handling static files.

``django.contrib.staticfiles`` collects static files from each of your
applications (and any other places you specify) into a single location that
can easily be served in production.

.. seealso::

    For an introduction to the static files app and some usage examples, see
    :doc:`/howto/static-files/index`. For guidelines on deploying static files,
    see :doc:`/howto/static-files/deployment`.

.. _staticfiles-settings:

Settings
========

See :ref:`staticfiles settings <settings-staticfiles>` for details on the
following settings:

* :setting:`STATIC_ROOT`
* :setting:`STATIC_URL`
* :setting:`STATICFILES_DIRS`
* :setting:`STATICFILES_STORAGE`
* :setting:`STATICFILES_FINDERS`

Management Commands
===================

``django.contrib.staticfiles`` exposes three management commands.

collectstatic
-------------

.. django-admin:: collectstatic

Collects the static files into :setting:`STATIC_ROOT`.

Duplicate file names are by default resolved in a similar way to how template
resolution works: the file that is first found in one of the specified
locations will be used. If you're confused, the :djadmin:`findstatic` command
can help show you which files are found.

Files are searched by using the :setting:`enabled finders
<STATICFILES_FINDERS>`. The default is to look in all locations defined in
:setting:`STATICFILES_DIRS` and in the ``'static'`` directory of apps
specified by the :setting:`INSTALLED_APPS` setting.

The :djadmin:`collectstatic` management command calls the
:meth:`~django.contrib.staticfiles.storage.StaticFilesStorage.post_process`
method of the :setting:`STATICFILES_STORAGE` after each run and passes
a list of paths that have been found by the management command. It also
receives all command line options of :djadmin:`collectstatic`. This is used
by the :class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage`
by default.

By default, collected files receive permissions from
:setting:`FILE_UPLOAD_PERMISSIONS` and collected directories receive permissions
from :setting:`FILE_UPLOAD_DIRECTORY_PERMISSIONS`. If you would like different
permissions for these files and/or directories, you can subclass either of the
:ref:`static files storage classes <staticfiles-storages>` and specify the
``file_permissions_mode`` and/or ``directory_permissions_mode`` parameters,
respectively. For example::

    from django.contrib.staticfiles import storage

    class MyStaticFilesStorage(storage.StaticFilesStorage):
        def __init__(self, *args, **kwargs):
            kwargs['file_permissions_mode'] = 0o640
            kwargs['directory_permissions_mode'] = 0o760
            super(CustomStaticFilesStorage, self).__init__(*args, **kwargs)

Then set the :setting:`STATICFILES_STORAGE` setting to
``'path.to.MyStaticFilesStorage'``.

.. versionadded:: 1.7

    The ability to override ``file_permissions_mode`` and
    ``directory_permissions_mode`` is new in Django 1.7.  Previously the file
    permissions always used :setting:`FILE_UPLOAD_PERMISSIONS` and the directory
    permissions always used :setting:`FILE_UPLOAD_DIRECTORY_PERMISSIONS`.

.. highlight:: console

Some commonly used options are:

.. django-admin-option:: --noinput

    Do NOT prompt the user for input of any kind.

.. django-admin-option:: -i <pattern>
.. django-admin-option:: --ignore <pattern>

    Ignore files or directories matching this glob-style pattern. Use multiple<commit_msg>Fixed #23607 -- Typo in docs/ref/contrib/staticfiles.txt.<commit_after>===================
The staticfiles app
===================

.. module:: django.contrib.staticfiles
   :synopsis: An app for handling static files.

``django.contrib.staticfiles`` collects static files from each of your
applications (and any other places you specify) into a single location that
can easily be served in production.

.. seealso::

    For an introduction to the static files app and some usage examples, see
    :doc:`/howto/static-files/index`. For guidelines on deploying static files,
    see :doc:`/howto/static-files/deployment`.

.. _staticfiles-settings:

Settings
========

See :ref:`staticfiles settings <settings-staticfiles>` for details on the
following settings:

* :setting:`STATIC_ROOT`
* :setting:`STATIC_URL`
* :setting:`STATICFILES_DIRS`
* :setting:`STATICFILES_STORAGE`
* :setting:`STATICFILES_FINDERS`

Management Commands
===================

``django.contrib.staticfiles`` exposes three management commands.

collectstatic
-------------

.. django-admin:: collectstatic

Collects the static files into :setting:`STATIC_ROOT`.

Duplicate file names are by default resolved in a similar way to how template
resolution works: the file that is first found in one of the specified
locations will be used. If you're confused, the :djadmin:`findstatic` command
can help show you which files are found.

Files are searched by using the :setting:`enabled finders
<STATICFILES_FINDERS>`. The default is to look in all locations defined in
:setting:`STATICFILES_DIRS` and in the ``'static'`` directory of apps
specified by the :setting:`INSTALLED_APPS` setting.

The :djadmin:`collectstatic` management command calls the
:meth:`~django.contrib.staticfiles.storage.StaticFilesStorage.post_process`
method of the :setting:`STATICFILES_STORAGE` after each run and passes
a list of paths that have been found by the management command. It also
receives all command line options of :djadmin:`collectstatic`. This is used
by the :class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage`
by default.

By default, collected files receive permissions from
:setting:`FILE_UPLOAD_PERMISSIONS` and collected directories receive permissions
from :setting:`FILE_UPLOAD_DIRECTORY_PERMISSIONS`. If you would like different
permissions for these files and/or directories, you can subclass either of the
:ref:`static files storage classes <staticfiles-storages>` and specify the
``file_permissions_mode`` and/or ``directory_permissions_mode`` parameters,
respectively. For example::

    from django.contrib.staticfiles import storage

    class MyStaticFilesStorage(storage.StaticFilesStorage):
        def __init__(self, *args, **kwargs):
            kwargs['file_permissions_mode'] = 0o640
            kwargs['directory_permissions_mode'] = 0o760
            super(MyStaticFilesStorage, self).__init__(*args, **kwargs)

Then set the :setting:`STATICFILES_STORAGE` setting to
``'path.to.MyStaticFilesStorage'``.

.. versionadded:: 1.7

    The ability to override ``file_permissions_mode`` and
    ``directory_permissions_mode`` is new in Django 1.7.  Previously the file
    permissions always used :setting:`FILE_UPLOAD_PERMISSIONS` and the directory
    permissions always used :setting:`FILE_UPLOAD_DIRECTORY_PERMISSIONS`.

.. highlight:: console

Some commonly used options are:

.. django-admin-option:: --noinput

    Do NOT prompt the user for input of any kind.

.. django-admin-option:: -i <pattern>
.. django-admin-option:: --ignore <pattern>

    Ignore files or directories matching this glob-style pattern. Use multiple
{'fraction_non_alphanumeric': 0.10645966176878292, 'fraction_numerical': 0.004019961186581647, 'mean_word_length': 5.04777870913663, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3495617', 'n_tokens_mistral': 2012, 'n_tokens_neox': 1905, 'n_words': 705}