dpaste/docs/settings.rst

37 lines
962 B
ReStructuredText
Raw Normal View History

2018-06-22 20:37:54 +10:00
==========================
Settings and Configuration
==========================
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
`introduced in Django 1.9`_ and allows you to set settings more programmatically.
2013-12-18 21:28:45 +11:00
2018-06-22 20:37:54 +10:00
Please see the source of ``dpaste.apps.dpasteAppConfig`` 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/