2013-12-18 21:28:45 +11:00
|
|
|
====================
|
|
|
|
Settings to override
|
|
|
|
====================
|
|
|
|
|
|
|
|
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
|
|
|
|
behavior without touching the code:
|
|
|
|
|
|
|
|
.. glossary::
|
|
|
|
|
|
|
|
``DPASTE_SLUG_LENGTH``
|
2014-04-13 00:08:32 +10:00
|
|
|
Integer. Length of the random slug for each new snippet. In the rare
|
|
|
|
case an existing slug is generated again, the length will increase by
|
|
|
|
one more character.
|
2013-12-18 21:28:45 +11:00
|
|
|
Default: ``4``
|
|
|
|
|
|
|
|
``DPASTE_SLUG_CHOICES``
|
|
|
|
String. A string of characters which are used to create the random slug.
|
2014-10-01 06:17:17 +10:00
|
|
|
Default: ``abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890``
|
2013-12-18 21:28:45 +11:00
|
|
|
|
|
|
|
``DPASTE_LEXER_DEFAULT``
|
|
|
|
String. The lexer key that is pre-selected in the dropdown. Note that
|
|
|
|
this is only used if the user has not saved a snippet before, otherwise
|
|
|
|
we use the last-used lexer. Default: ``python``
|
|
|
|
|
|
|
|
``DPASTE_MAX_CONTENT_LENGTH``
|
|
|
|
Integer. Maximum number of bytes per snippet. Default: ``250 * 1024 * 1024``
|
|
|
|
|
|
|
|
``DPASTE_MAX_SNIPPETS_PER_USER``
|
|
|
|
Integer. Maximum number of snippets we save in teh user session and
|
|
|
|
display on the history page. Default: ``10``
|
|
|
|
|
|
|
|
``DPASTE_BASE_URL``
|
|
|
|
String. The full qualified hostname and path to the dpaste instance.
|
|
|
|
This is used to generate a link in the API response. Default: ``https://dpaste.de``
|
|
|
|
|
2018-04-06 03:16:02 +10:00
|
|
|
``DPASTE_LEXER_CHOICES``
|
2013-12-18 21:28:45 +11:00
|
|
|
Choices. A tuple of choices of Pygments lexers used in the lexer
|
|
|
|
dropdown. Here is the full `lexer list`_ which is currently used.
|
|
|
|
Example::
|
|
|
|
|
2018-04-06 03:16:02 +10:00
|
|
|
DPASTE_LEXER_CHOICES = (
|
2013-12-18 21:28:45 +11:00
|
|
|
('delphi', 'Delphi'),
|
|
|
|
('php', 'PHP'),
|
|
|
|
('text', 'Text'),
|
|
|
|
)
|
|
|
|
|
|
|
|
``DPASTE_EXPIRE_CHOICES``
|
|
|
|
Choices. A tuple of seconds and a descriptive string used in the lexer
|
|
|
|
expiration dropdown. Example::
|
|
|
|
|
2014-10-28 22:14:30 +11:00
|
|
|
from django.utils.translation import ugettext_lazy as _
|
2013-12-18 21:28:45 +11:00
|
|
|
DPASTE_EXPIRE_CHOICES = (
|
2018-04-29 19:47:24 +10:00
|
|
|
(3600, _('In one hour')),
|
|
|
|
(3600 * 24 * 7, _('In one week')),
|
|
|
|
(3600 * 24 * 30, _('In one month')),
|
|
|
|
(3600 * 24 * 30 * 12 * 100, _('100 Years')),
|
2013-12-18 21:28:45 +11:00
|
|
|
)
|
|
|
|
|
2014-10-28 22:05:47 +11:00
|
|
|
**One-Time snippets** are supported. One-Time snippets are automatically
|
2014-01-21 22:57:29 +11:00
|
|
|
deleted once a defined view count has reached (Default: ``2``). To
|
|
|
|
enable one-time snippets you have to add a choice ``onetime`` to the
|
|
|
|
expire choices::
|
|
|
|
|
2014-10-28 22:14:30 +11:00
|
|
|
from django.utils.translation import ugettext_lazy as _
|
2014-01-21 22:57:29 +11:00
|
|
|
DPASTE_EXPIRE_CHOICES = (
|
2018-04-29 19:47:24 +10:00
|
|
|
('onetime', _('One-Time snippet')),
|
|
|
|
(3600, _('In one hour')),
|
|
|
|
(3600 * 24 * 7, _('In one week')),
|
|
|
|
(3600 * 24 * 30, _('In one month')),
|
2014-01-21 22:57:29 +11:00
|
|
|
)
|
|
|
|
|
|
|
|
You can also set the maximum view count after what the snippet gets
|
|
|
|
deleted. The default is ``2``. One view is from the author, one view
|
|
|
|
is from another user::
|
|
|
|
|
|
|
|
DPASTE_ONETIME_LIMIT = 2
|
|
|
|
|
|
|
|
**Infinite snippets** are supported. You can keep snippets forever when
|
|
|
|
you set the choice key to ``never``. The management command will ignore
|
|
|
|
these snippets::
|
2014-01-12 02:00:11 +11:00
|
|
|
|
2014-10-28 22:14:30 +11:00
|
|
|
from django.utils.translation import ugettext_lazy as _
|
2014-01-12 02:00:11 +11:00
|
|
|
DPASTE_EXPIRE_CHOICES = (
|
2018-04-29 19:47:24 +10:00
|
|
|
(3600, _('In one hour')),
|
|
|
|
('never', _('Never')),
|
2014-01-12 02:00:11 +11:00
|
|
|
)
|
|
|
|
|
2013-12-18 21:28:45 +11:00
|
|
|
``DPASTE_EXPIRE_DEFAULT``
|
|
|
|
The key of the default value of ``DPASTE_EXPIRE_CHOICES``. Default:
|
|
|
|
``3600 * 24 * 30 * 12 * 100`` or simpler: ``DPASTE_EXPIRE_CHOICES[2][0]``.
|
|
|
|
|
2014-10-02 03:52:49 +10:00
|
|
|
``DPASTE_ENABLE_GIST``
|
2017-01-19 22:16:07 +11:00
|
|
|
**Removed in Version 2.13!**
|
2014-10-02 03:52:49 +10:00
|
|
|
Boolean. Whether to display the Gist button for re-pasting to GitHub.
|
|
|
|
Default: ``True``
|
|
|
|
|
2016-03-25 06:16:34 +11:00
|
|
|
..warning: This feature was removed in v2.11.
|
|
|
|
|
2014-06-09 04:21:59 +10:00
|
|
|
``DPASTE_DEFAULT_GIST_NAME``
|
2017-01-19 22:16:07 +11:00
|
|
|
**Removed in Version 2.13!**
|
2014-06-09 04:21:59 +10:00
|
|
|
String. The filename used when pasting a snippet on Github Gist.
|
|
|
|
Default: ``dpaste.de_snippet.py``
|
2013-12-18 21:28:45 +11:00
|
|
|
|
2014-06-09 04:21:59 +10:00
|
|
|
``DPASTE_DEFAULT_GIST_DESCRIPTION``
|
2017-01-19 22:16:07 +11:00
|
|
|
**Removed in Version 2.13!**
|
2014-06-09 04:21:59 +10:00
|
|
|
String. The filename used when pasting a snippet on Github Gist.
|
|
|
|
Default: ``dpaste.de_snippet.py``
|
2013-12-18 21:28:45 +11:00
|
|
|
|
2014-10-02 03:52:49 +10:00
|
|
|
``DPASTE_JQUERY_URL``
|
|
|
|
String. URL to use for jQuery.
|
|
|
|
Default: ``//ajax.googleapis.com/ajax/libs/jquery/1/jquery.js``
|
|
|
|
|
2013-12-18 21:28:45 +11:00
|
|
|
.. _lexer list: https://github.com/bartTC/dpaste/blob/master/dpaste/highlight.py#L25
|