dpaste/README.rst

81 lines
2.4 KiB
ReStructuredText
Raw Permalink Normal View History

======
2013-03-23 08:54:41 +11:00
dpaste
======
.. image:: https://travis-ci.org/bartTC/dpaste.png?branch=master
:target: https://travis-ci.org/bartTC/dpaste
.. image:: https://coveralls.io/repos/bartTC/dpaste/badge.png?branch=master
:target: https://coveralls.io/r/bartTC/dpaste?branch=master
2013-11-26 21:40:36 +11:00
2013-11-30 04:58:02 +11:00
dpaste is a Django based pastebin. It's intended to run separately but its also
2013-11-30 04:46:38 +11:00
possible to be installed into an existing Django project like a regular app.
2013-03-23 08:54:41 +11:00
You can find a live example on http://dpaste.de/
2013-03-23 08:54:41 +11:00
-----------------------------
2013-11-30 04:46:38 +11:00
Testing and local development
-----------------------------
2013-11-26 21:40:36 +11:00
dpaste is continuously tested on _Travis. You can also run the test
suite locally with _tox::
2013-11-26 21:40:36 +11:00
2013-11-30 04:58:02 +11:00
$ cd dpaste/
2013-11-26 21:40:36 +11:00
$ pip install tox
$ tox
A more manual approach is installing it all by hand in a virtual environment.
This is also the preferred way to setup an environment for local development::
2013-03-23 08:54:41 +11:00
2013-11-30 04:58:02 +11:00
$ cd dpaste/
2013-11-26 21:40:36 +11:00
$ pip install -e .
$ pip install -r requirements.txt
$ python runtests.py
2013-03-23 08:54:41 +11:00
_Travis: https://travis-ci.org/bartTC/dpaste
_tox: http://tox.readthedocs.org/en/latest/
2013-11-30 04:46:38 +11:00
-----------------------------------------
2013-11-30 04:46:38 +11:00
Integrate dpaste into an existing project
-----------------------------------------
2013-11-30 04:58:02 +11:00
Dpaste needs at least Django 1.4+ and is tested on Python 2.7 as well as
Python 3.3.
2013-11-30 04:46:38 +11:00
2013-11-30 04:58:02 +11:00
Install the latest dpaste release in your environment. This will install all
2013-11-30 04:46:38 +11:00
necessary dependencies of dpaste as well.
pip install https://github.com/bartTC/dpaste
Add `dpaste` and (preferred) `south` to your `INSTALLED_APPS`::
2013-11-30 04:46:38 +11:00
INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.staticfiles',
# ...
'mptt',
'dpaste',
# 'south', (supported)
)
Add ``dpaste`` and if you want the ``dpaste_api`` to your urlpatterns::
2013-11-30 04:46:38 +11:00
urlpatterns = patterns('',
# ...
url(r'pastebin/', include('dpaste.urls.dpaste')),
url(r'pastebin/api/', include('dpaste.urls.dpaste_api')),
)
Finally just ``syncdb`` or if you use South, migrate::
2013-11-30 04:46:38 +11:00
manage.py migrate dpaste
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::
2013-11-30 04:46:38 +11:00
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.