dpaste/docs/integration.rst

47 lines
1.3 KiB
ReStructuredText
Raw Normal View History

2013-12-18 21:28:45 +11:00
=========================================
Integrate dpaste into an existing project
=========================================
Install the latest dpaste release in your environment. This will install all
necessary dependencies of dpaste as well::
pip install dpaste
2018-03-12 21:59:38 +11:00
Add ``dpaste.apps.dpasteAppConfig`` to your ``INSTALLED_APPS``::
2013-12-18 21:28:45 +11:00
INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.staticfiles',
# ...
2018-03-12 21:59:38 +11:00
'dpaste.apps.dpasteAppConfig',
2013-12-18 21:28:45 +11:00
)
2015-08-12 14:25:22 +10:00
Add ``dpaste`` — and if you want — the ``dpaste_api`` to your urlpatterns::
2013-12-18 21:28:45 +11:00
urlpatterns = patterns('',
# ...
url(r'pastebin/', include('dpaste.urls.dpaste')),
url(r'pastebin/api/', include('dpaste.urls.dpaste_api')),
)
2015-08-12 14:25:22 +10:00
Finally just migrate the database schema::
2013-12-18 21:28:45 +11:00
manage.py migrate dpaste
2018-06-22 20:37:54 +10:00
2014-01-12 02:00:11 +11:00
Purge expired snippets
======================
2013-12-18 21:28:45 +11:00
Do not forget to setup a cron job to purge expired snippets. You need to
run the management command ``cleanup_snippets``. A cron job I use looks like::
30 * * * * /srv/dpaste.de/bin/python /srv/dpaste.de/bin/manage.py cleanup_snippets > /dev/null
Note also that dpaste does *not* come with Django admin integration. You need
to setup an register the models in an ``admin.py`` yourself.
.. note::
For further customization see :doc:`settings`.