A simple, self-hosted pastebin web application built with Flask.
Supports rate limiting, CSRF protection, encrypted contents and automatic cleanup of old pastes.
- Create and share text pastes with unique URLs
- View raw paste content
- Rate limiting per IP address
- CSRF protection for POST requests
- Encrypted pastes
- Automatic deletion of pastes older than (user defined)
- Burn after reading
- Configurable via environment variables
- Runs locally or in Docker
-
Clone the repository:
git clone https://github.com/teklynk/python_paste.git cd python_paste
-
Create a virtual environment:
python3 -m venv venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables:
- Rename
sample.env
to.env
- Edit
.env
and set yourSECRET_KEY
andALLOWED_DOMAIN
- Rename
-
Run the application:
python3 python_paste.py
-
Deactivate the virtual environment (optional):
deactivate
-
Configure environment variables:
- Rename
sample.docker-compose.yml
todocker-compose.yml
- Edit
docker-compose.yml
and set yourSECRET_KEY
,ALLOWED_DOMAIN
andENCRYPTION_KEY
under theenvironment
section
- Rename
-
Build and run the container:
docker-compose up --build
- On first run, the app will generated a
ENCRYPTION_KEY
and save it to the.env
if it does not already exist. Fernet key must be 32 url-safe base64-encoded bytes. - If running locally, ensure
.env
is present and configured.ENCRYPTION_KEY
key must be 32 url-safe base64-encoded bytes. - If using Docker, configure environment variables in
docker-compose.yml
. Do not use the.env
file with docker. The.env
is only needed when running the app locally withpython3 python_paste.py
. - Pastes older than 90 days are deleted automatically if not defined in
PASTEBIN_EXPIRATION_DAYS
. BURN_AFTER_READING_VIEWS
is set to 3 views by default if not defined in.env
ordocker-compose.yml
.- The app is designed to work behind a reverse proxy (e.g., Nginx, Cloudflare) and supports real client IP detection.