Thanks to visit codestin.com
Credit goes to github.com

Skip to content

thepiloter/paste.py

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

paste.py 🐍

paste.py is a modern pastebin service written in Python using FastAPI. It allows users to share code snippets and text files through a web interface or REST API, with support for syntax highlighting, file uploads, and expiration times.

Prerequisites

Local Setup

Step 1: Clone and Setup

Clone the repository and navigate to project directory:

git clone https://github.com/thepiloter/paste.py.git
cd paste.py

Step 2: Configure Environment

Create environment file from example:

cp .env.example .env

The .env.example file already contains working default values suitable for local development.

Step 3: Start Services

Run the application using Docker Compose:

docker-compose up -d

The first startup may take a few minutes as it downloads images and sets up the database.

Step 4: Access Application

Open your browser and navigate to: http://localhost:8082

The application provides:

Usage

Web Interface

Navigate to http://localhost:8082/web to create and share pastes through the browser interface.

API Usage

Use curl or any HTTP client to interact with the REST API:

# Create a paste
curl -X POST "http://localhost:8082/api/paste" \
     -H "Content-Type: application/json" \
     -d '{"content": "Hello World", "extension": "txt"}'

# Upload a file
curl -X POST -F "[email protected]" http://localhost:8082/file

Management Commands

Run application commands using docker compose:

# Run database migrations
docker compose exec myapp pdm run migrate

# Run tests
docker compose exec myapp pdm run test

Container Management

# Stop containers (data persists)
docker compose stop

# Start containers
docker compose start

# Stop and remove containers
docker compose down

Development Setup (Without Docker)

If you prefer to run the application directly, you'll need additional services:

Prerequisites

  • Python 3.10+ (3.11.3 recommended)
  • PDM
  • Running MinIO server (for file storage)
  • SQLite (included with Python)

Setup

git clone https://github.com/thepiloter/paste.py.git
cd paste.py

# Configure environment
cp .env.example .env
# Edit .env to update MINIO_CLIENT_LINK and BASE_URL for your setup

# Install dependencies
pdm install

# Run database migrations
pdm run migrate

# Start the application
pdm run start

The application will be available at http://localhost:8080

Note: You'll need to run MinIO separately or update the .env file to point to an existing S3-compatible storage service.

Contributing

Please read the Code of Conduct and Contributing Guidelines before contributing.

License

This project is licensed under the MIT License.

About

paste.py 🐍 - A pastebin written in python.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 53.3%
  • Python 45.5%
  • Other 1.2%