dpaste/docs/settings.rst

49 lines
1.1 KiB
ReStructuredText
Raw Normal View History

2018-06-24 05:12:46 +10:00
.. _settings:
2019-12-09 05:39:43 +11:00
========
Settings
========
2013-12-18 21:28:45 +11:00
When dpaste is installed as a standalone service or integrated into an existing
project there are various settings you can override to adjust dpaste's
2018-06-22 20:37:54 +10:00
behavior.
2013-12-18 21:28:45 +11:00
2018-06-22 20:37:54 +10:00
To do so, you need to override dpaste's AppConfig. This is a feature
2018-06-24 05:12:46 +10:00
`introduced in Django 1.9`_ and allows you to set settings more
programmatically.
2013-12-18 21:28:45 +11:00
2018-06-24 05:12:46 +10:00
See :ref:`current_appconfig` for a full list of settings and functions you
can override.
2013-12-18 21:28:45 +11:00
2018-06-22 20:37:54 +10:00
Example for your custom AppConfig:
==================================
2013-12-18 21:28:45 +11:00
2018-06-22 20:37:54 +10:00
.. code-block:: python
2013-12-18 21:28:45 +11:00
2018-06-22 20:37:54 +10:00
# settings.py
from dpaste.apps import dpasteAppConfig
2013-12-18 21:28:45 +11:00
2018-06-22 20:37:54 +10:00
class MyBetterDpasteAppConfig(dpasteAppConfig):
SLUG_LENGTH = 8
LEXER_DEFAULT = 'js'
2013-12-18 21:28:45 +11:00
2018-06-22 20:37:54 +10:00
# ...
2013-12-18 21:28:45 +11:00
2018-06-22 20:37:54 +10:00
INSTALLED_APPS = [
'myproject.settings.MyBetterDpasteAppConfig',
]
2013-12-18 21:28:45 +11:00
2018-06-22 20:37:54 +10:00
.. _introduced in Django 1.9: https://docs.djangoproject.com/en/1.9/ref/applications/
2018-06-24 05:12:46 +10:00
.. _current_appconfig:
Current AppConfig with default values
=====================================
This is the file content of ``dpaste/apps.py``:
.. literalinclude:: ../dpaste/apps.py
:language: python