pasteque/README.md

86 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

2023-04-21 13:03:18 +00:00
# Paf'Pastèque
2013-04-04 17:37:30 +00:00
2020-05-31 14:36:25 +00:00
## About
2013-04-04 17:37:30 +00:00
2020-05-31 14:36:25 +00:00
**Pasteque** is a free and open source (MIT License) **Pastebin like**
application written in Python/Django.
2023-04-21 13:03:18 +00:00
An instance can be found at: [p.afpy.org](https://p.afpy.org). The AFPy
2020-05-31 14:36:25 +00:00
instance is installed by ansible, the role is available here:
2023-04-21 13:03:18 +00:00
[https://git.afpy.org/AFPy/infra/src/branch/main/roles/pasteque](https://git.afpy.org/AFPy/infra/src/branch/main/roles/pasteque).
2020-05-31 14:36:25 +00:00
## Features
2013-04-04 17:37:30 +00:00
- Support any database supported by Django (Sqlite3, MySQL, PostgreSQL, Oracle, ...)
- Syntax highlighting for a bunch of languages using Pygments.
2023-04-25 16:01:34 +00:00
- Rendering of Markdown as HTML.
2023-04-21 13:03:18 +00:00
- Easy paste from command line or any programming language.
2013-04-04 17:37:30 +00:00
2020-05-31 14:36:25 +00:00
2023-04-25 16:01:34 +00:00
## Using
2023-07-18 13:53:07 +00:00
See [using.en.md](using.en.md) or [using.fr.md](using.fr.md).
## FAQ
2023-04-25 16:01:34 +00:00
### 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.
2023-04-25 16:01:34 +00:00
### 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 `PUT`ting to it, and list all its pastes by querying:
curl localhost:8000/::/list/ -H "Authorization: Secret supersecret"
2020-05-31 14:36:25 +00:00
## Running Pasteque
In a [venv](https://docs.python.org/3/library/venv.html), install the requirements:
pip install -r requirements.txt
2023-04-21 13:03:18 +00:00
In a `local_settings.py` file, at the root of the repo:
2020-05-31 14:36:25 +00:00
DISPLAY_NAME = 'YourCompany-Paste'
COMPRESS_ENABLED = True
2023-04-21 13:03:18 +00:00
DEBUG = False
2020-05-31 14:36:25 +00:00
SECRET_KEY = 'fill_a_secret_key_here'
2023-04-21 13:03:18 +00:00
ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'paste.henriet.eu']
2020-05-31 14:36:25 +00:00
2023-04-21 13:03:18 +00:00
Create the database:
2020-05-31 14:36:25 +00:00
./manage.py migrate
If you're in production collect static files:
./manage.py collectstatic
Run it:
./manage.py runserver