From 9d1d52e6693506f048eda3d2a7daf180c597ef19 Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Fri, 29 Nov 2013 18:46:38 +0100 Subject: [PATCH] Better docs. --- README.md | 60 ++++++++++++++++++++++++++++++++++++++++---- docs/integration.rst | 41 ------------------------------ requirements.txt | 2 ++ 3 files changed, 57 insertions(+), 46 deletions(-) delete mode 100644 docs/integration.rst diff --git a/README.md b/README.md index 15a92af..f0152bf 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,13 @@ dpaste [![Build Status](https://travis-ci.org/bartTC/dpaste.png?branch=master)](https://travis-ci.org/bartTC/dpaste) [![Coverage Status](https://coveralls.io/repos/bartTC/dpaste/badge.png?branch=master)](https://coveralls.io/r/bartTC/dpaste?branch=master) -dpaste is a Django based pastebin. It's intended to run separatly or installed -into an existing Django project. +dpaste is a Django based pastebin. It's intended to run separatly but its also +possible to be installed into an existing Django project like a regular app. You can find a live example on http://dpaste.de/ -Testing -------- +Testing and local development +----------------------------- dpaste is continuously tested on [Travis][travis]. You can also run the test suite locally with [tox][tox]: @@ -19,7 +19,7 @@ suite locally with [tox][tox]: $ tox A more manual approach is installing it all by hand in a virtual environment. -This is also the preferred way local development: +This is also the preferred way to setup an environment for local development: $ pip install -e . $ pip install -r requirements.txt @@ -27,3 +27,53 @@ This is also the preferred way local development: [travis]: https://travis-ci.org/bartTC/dpaste [tox]: http://tox.readthedocs.org/en/latest/ + +Integrate dpaste into an existing project +----------------------------------------- + +Dpaste needs at Django 1.4+ and is tested on Python 2.7 as well as Python 3.3. + +You already have a full Django based project running. If not, and you still +want to proceed just create a simple barebone project: + + $ mkvirtualenv dpaste-example + $ pip install django south + $ django-admin.py startproject myproject + +Install the latest dpaste release in your envoirenment. This will install all +necessary dependencies of dpaste as well. + + pip install https://github.com/bartTC/dpaste + +Add `dpaste` and (preferred) `south` to your `INSTALLED_APPS`: + + INSTALLED_APPS = ( + 'django.contrib.sessions', + 'django.contrib.staticfiles', + # ... + + 'mptt', + 'dpaste', + # 'south', (supported) + ) + +Add `dpaste` and if you want the `dpaste_api` to your urlpatterns: + + 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: + + 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: + + 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. diff --git a/docs/integration.rst b/docs/integration.rst deleted file mode 100644 index 73839b7..0000000 --- a/docs/integration.rst +++ /dev/null @@ -1,41 +0,0 @@ -================================================= -How to integrate dpaste into an existing project: -================================================= - -You already have a full Django based project running. If not, and you still -want to proceed just create a simple barebone project: - - $ mkvirtualenv dpaste-example - $ pip install django south - $ django-admin.py startproject myproject - -Install the latest dpaste release in your envoirenment. This will install all -necessary dependencies of dpaste as well, **except Django and South**. Since -you here integrate dpaste into your project its likely those are already -installed:: - - pip install https://github.com/bartTC/dpaste - -Add `dpaste` and (preferred) `south` to your `INSTALLED_APPS`:: - - INSTALLED_APPS = ( - 'django.contrib.sessions', - 'django.contrib.staticfiles', - # ... - - 'dpaste', - 'south', - ) - -Add `dpaste` and if you want the `dpaste_api` to your urlpatterns: - - urlpatterns = patterns('', - # ... - - url(r'pastebin/', include('dpaste.urls.dpaste')), - url(r'pastebin/api/', include('dpaste.urls.dpaste_api')), - ) - -Finally just migrate: - - manage.py migrate dpaste diff --git a/requirements.txt b/requirements.txt index 246ca0d..a075d7f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,6 +9,8 @@ python-coveralls==2.4.0 coverage==3.7 tox==1.6.1 sphinx==1.1.3 +sphinx_rtd_theme +markdown2==2.1.0 # Deployment specific django-redis==3.3