Go to file
2024-10-16 22:00:38 +02:00
paste Better filename normalization to avoid issues with ../. 2024-10-16 22:00:38 +02:00
webtools Group pastes from a same upload with the same slug. 2023-04-25 10:49:36 +02:00
.gitignore Proofreading README 2023-04-21 15:05:11 +02:00
LICENSE.md first commit 2013-04-04 19:37:30 +02:00
manage.py first commit 2013-04-04 19:37:30 +02:00
README.md Translating using in english. 2023-07-18 15:53:07 +02:00
requirements.in Also pretty print Markdown. 2023-04-25 09:22:03 +02:00
requirements.txt Also pretty print Markdown. 2023-04-25 09:22:03 +02:00
using.en.md Translating using in english. 2023-07-18 15:53:07 +02:00
using.fr.md Translating using in english. 2023-07-18 15:53:07 +02:00

Paf'Pastèque

About

Pasteque is a free and open source (MIT License) Pastebin like application written in Python/Django.

An instance can be found at: p.afpy.org. The AFPy instance is installed by ansible, the role is available here: https://git.afpy.org/AFPy/infra/src/branch/main/roles/pasteque.

Features

  • Support any database supported by Django (Sqlite3, MySQL, PostgreSQL, Oracle, ...)
  • Syntax highlighting for a bunch of languages using Pygments.
  • Rendering of Markdown as HTML.
  • Easy paste from command line or any programming language.

Using

See using.en.md or using.fr.md.

FAQ

Where's the homepage?

This pastebin has no homepage: its homepage is a paste like any other. So to create one for your instance, just paste something to it, like:

$ curl localhost:8000 -XPUT -H "Authorization: Secret supersecret" --data-binary @using.fr.md

The Authorization allows you to update the paste by uploading it again.

I want a robots.txt

Just past it:

$ printf "User-agent: *\nDisallow: /\n" | curl localhost:8000/robots.txt -XPUT -H "Authorization: Secret supersecret" --data-binary @-

It'll work as .txt files are not pretty printed.

Where's the admin?

The admin is hosted as /::/admin/. As almost any URL can be used by pastes, we "burry" the admin here.

And no paste can start with ::.

What's this Authorization header?

By providing a secret in the Authorization header, one can edit its pasts by PUTting to it, and list all its pastes by querying:

curl localhost:8000/::/list/ -H "Authorization: Secret supersecret"

Running Pasteque

In a venv, install the requirements:

pip install -r requirements.txt

In a local_settings.py file, at the root of the repo:

DISPLAY_NAME = 'YourCompany-Paste'
COMPRESS_ENABLED = True
DEBUG = False
SECRET_KEY = 'fill_a_secret_key_here'
ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'paste.henriet.eu']

Create the database:

./manage.py migrate

If you're in production collect static files:

./manage.py collectstatic

Run it:

./manage.py runserver