Go to file
Melcore 00a2df14ff Permet le rendu des fichiers html dans le navigateur
Afin d'ajouter réellement des fonctionnalités de blog, on peut rendre les fichiers html, css, js normalement sans pygments.

J'ai pas les moyens de tester si y a pas de bug, et je voulais soumettre l'idée rapidement.
2023-05-11 21:13:48 +00:00
paste Permet le rendu des fichiers html dans le navigateur 2023-05-11 21:13:48 +00: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
README.md .txt files should not be interpreted as Markdown. 2023-04-25 22:12:48 +02:00
manage.py first commit 2013-04-04 19:37:30 +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.fr.md .txt files should not be interpreted as Markdown. 2023-04-25 22:12:48 +02:00

README.md

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

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