mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 08:02:54 +11:00
v3.0
This commit is contained in:
commit
470b8dd2b3
6 changed files with 15 additions and 9 deletions
|
@ -10,6 +10,7 @@ env:
|
||||||
- DJANGO: django>=1.8,<1.9
|
- DJANGO: django>=1.8,<1.9
|
||||||
- DJANGO: django>=1.9,<1.10
|
- DJANGO: django>=1.9,<1.10
|
||||||
- DJANGO: django>=1.10,<1.11
|
- DJANGO: django>=1.10,<1.11
|
||||||
|
- DJANGO: django>=1.11,<1.12
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- pip install codecov
|
- pip install codecov
|
||||||
|
|
|
@ -123,6 +123,6 @@ A sample Python 2 script to publish snippets::
|
||||||
|
|
||||||
You can simply use curl to publish a whole file::
|
You can simply use curl to publish a whole file::
|
||||||
|
|
||||||
$ alias dpaste="curl -F 'content=<-' https://dpaste.de/api/?format=url"
|
$ alias dpaste="curl -F 'format=url' -F 'content=<-' https://dpaste.de/api/"
|
||||||
$ cat foo.txt | dpaste
|
$ cat foo.txt | dpaste
|
||||||
https://dpaste.de/ke2pB
|
https://dpaste.de/ke2pB
|
||||||
|
|
|
@ -15,11 +15,15 @@ Ready to contribute? Here's how to set up `dpaste` for local development.
|
||||||
$ cd dpaste/
|
$ cd dpaste/
|
||||||
$ pip install -r requirements.txt
|
$ pip install -r requirements.txt
|
||||||
|
|
||||||
4. Run the commands::
|
4. Copy the settings file and edit it, to meet your needs::
|
||||||
|
|
||||||
|
$ cp dpaste/settings/local.py.example dpaste/settings/local.py
|
||||||
|
$ nano dpaste/settings/local.py
|
||||||
|
|
||||||
|
5. Initialze the database by running the command::
|
||||||
|
|
||||||
$ python manage.py syncdb
|
|
||||||
$ python manage.py migrate
|
$ python manage.py migrate
|
||||||
|
|
||||||
5. Start up the webserver::
|
6. Start up the webserver::
|
||||||
|
|
||||||
$ python manage.py runserver
|
$ python manage.py runserver
|
||||||
|
|
|
@ -37,14 +37,14 @@
|
||||||
on this page</a>. For a quick start here is a code example (Python 2.x):</p>
|
on this page</a>. For a quick start here is a code example (Python 2.x):</p>
|
||||||
|
|
||||||
{# Just put the script in dpaste and copy the source node #}
|
{# Just put the script in dpaste and copy the source node #}
|
||||||
<div class="code python"><ol><li id="1"><span class="c">#!/usr/bin/env python</span></li><li id="2"> </li><li id="3"><span class="kn">from</span> <span class="nn">urllib</span> <span class="kn">import</span> <span class="n">urlencode</span></li><li id="4"><span class="kn">from</span> <span class="nn">urllib2</span> <span class="kn">import</span> <span class="n">Request</span><span class="p">,</span> <span class="n">urlopen</span></li><li id="5"><span class="kn">from</span> <span class="nn">sys</span> <span class="kn">import</span> <span class="n">stdin</span></li><li id="6"> </li><li id="7"><span class="k">def</span> <span class="nf">paste_code</span><span class="p">():</span></li><li id="8"> <span class="n">request</span> <span class="o">=</span> <span class="n">Request</span><span class="p">(</span><span class="s">'https://dpaste.de/api/'</span><span class="p">,</span> <span class="n">urlencode</span><span class="p">({</span></li><li id="9"> <span class="s">'content'</span><span class="p">:</span> <span class="n">stdin</span><span class="o">.</span><span class="n">read</span><span class="p">(),</span></li><li id="10"> <span class="s">'lexer'</span><span class="p">:</span> <span class="s">'python'</span><span class="p">,</span></li><li id="11"> <span class="s">'format'</span><span class="p">:</span> <span class="s">'url'</span><span class="p">,</span></li><li id="12"> <span class="p">}))</span></li><li id="13"> <span class="k">print</span> <span class="n">urlopen</span><span class="p">(</span><span class="n">request</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span></li><li id="14"> </li><li id="15"><span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">'__main__'</span><span class="p">:</span></li><li id="16"> <span class="n">paste_code</span><span class="p">()</span></li></ol></div>
|
<div class="code python"><ol><li id="1"><span class="c">#!/usr/bin/env python</span></li><li id="2"> </li><li id="3"><span class="kn">from</span> <span class="nn">urllib</span> <span class="kn">import</span> <span class="n">urlencode</span></li><li id="4"><span class="kn">from</span> <span class="nn">urllib2</span> <span class="kn">import</span> <span class="n">Request</span><span class="p">,</span> <span class="n">urlopen</span></li><li id="5"><span class="kn">from</span> <span class="nn">sys</span> <span class="kn">import</span> <span class="n">stdin</span></li><li id="6"> </li><li id="7"><span class="k">def</span> <span class="nf">paste_code</span><span class="p">():</span></li><li id="8"> <span class="n">request</span> <span class="o">=</span> <span class="n">Request</span><span class="p">(</span><span class="s">'{{ site_url }}/api/'</span><span class="p">,</span> <span class="n">urlencode</span><span class="p">({</span></li><li id="9"> <span class="s">'content'</span><span class="p">:</span> <span class="n">stdin</span><span class="o">.</span><span class="n">read</span><span class="p">(),</span></li><li id="10"> <span class="s">'lexer'</span><span class="p">:</span> <span class="s">'python'</span><span class="p">,</span></li><li id="11"> <span class="s">'format'</span><span class="p">:</span> <span class="s">'url'</span><span class="p">,</span></li><li id="12"> <span class="p">}))</span></li><li id="13"> <span class="k">print</span> <span class="n">urlopen</span><span class="p">(</span><span class="n">request</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span></li><li id="14"> </li><li id="15"><span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">'__main__'</span><span class="p">:</span></li><li id="16"> <span class="n">paste_code</span><span class="p">()</span></li></ol></div>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<p>Save this script in <code>/usr/local/bin/dpaste</code> and give it the executable bit: <code>chmod +x /usr/local/bin/dpaste</code>.</p>
|
<p>Save this script in <code>/usr/local/bin/dpaste</code> and give it the executable bit: <code>chmod +x /usr/local/bin/dpaste</code>.</p>
|
||||||
<p>Usage: <code>cat foo.txt | dpaste</code></p>
|
<p>Usage: <code>cat foo.txt | dpaste</code></p>
|
||||||
|
|
||||||
<p>An alternative would be to just use <code>curl</code>:
|
<p>An alternative would be to just use <code>curl</code>:
|
||||||
<code>alias dpaste="curl -F 'content=<-' https://dpaste.de/api/"</code></p>
|
<code>alias dpaste="curl -F 'content=<-' {{ site_url }}/api/"</code></p>
|
||||||
|
|
||||||
|
|
||||||
<h3>Applications using the API:</h3>
|
<h3>Applications using the API:</h3>
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Type the 4 letter code of your snippet in the field and submit.
|
Type the 4 letter code of your snippet in the field and submit.
|
||||||
Like this yellow one here: <tt>http://dpaste.de/<strong>SiZrT</strong></tt>
|
Like this yellow one here: <tt>{{ site_url }}/<strong>SiZrT</strong></tt>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form method="POST" action="{% url "snippet_delete" %}">
|
<form method="POST" action="{% url "snippet_delete" %}">
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -24,7 +24,7 @@ long_description = u'\n\n'.join((
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='dpaste',
|
name='dpaste',
|
||||||
version='2.13',
|
version='3.0a',
|
||||||
description='dpaste is a Django based pastebin. It\'s intended to run '
|
description='dpaste is a Django based pastebin. It\'s intended to run '
|
||||||
'separately but its also possible to be installed into an '
|
'separately but its also possible to be installed into an '
|
||||||
'existing Django project like a regular app.',
|
'existing Django project like a regular app.',
|
||||||
|
|
3
tox.ini
3
tox.ini
|
@ -2,7 +2,7 @@
|
||||||
toxworkdir=/tmp/tox/dpaste
|
toxworkdir=/tmp/tox/dpaste
|
||||||
skip_missing_interpreters=True
|
skip_missing_interpreters=True
|
||||||
envlist=
|
envlist=
|
||||||
py{27,34,35,36}-django-{18,19,110}
|
py{27,34,35,36}-django-{18,19,110,111}
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
install_command =
|
install_command =
|
||||||
|
@ -16,3 +16,4 @@ deps=
|
||||||
django-18: django>=1.8,<1.9
|
django-18: django>=1.8,<1.9
|
||||||
django-19: django>=1.9,<1.10
|
django-19: django>=1.9,<1.10
|
||||||
django-110: django>=1.10,<1.11
|
django-110: django>=1.10,<1.11
|
||||||
|
django-111: django>=1.11,<1.12
|
||||||
|
|
Loading…
Reference in a new issue