Pretty simple selfhosted file storage solution with web interface and REST API.
Perfect for home use and small teams.
- User authentication
- File upload via web interface or API
- Isolated storage per user
- Docker support
- 90%+ test coverage
- REST API for integration
- Easy deployment
- Clone repository:
git clone https://github.com/nikita-popov/pystorage.git
cd pystorage- Copy config template:
cp example.config.py config.py
- Configure settings in
config.py:
class Config:
SECRET_KEY = 'your-secret-key' # Generate with: openssl rand -hex 32
USERS = {
'admin': 'pbkdf2:sha256...', # Use generate_password_hash
}
- Password generation:
python -c "from werkzeug.security import generate_password_hash; print(generate_password_hash('my_strong_password'))"
docker compose up -d- Create a virtualenv and install dependencies:
python3 -m venv .venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt- Start app:
gunicorn --workers 4 --bind 0.0.0.0:5000 wsgi-app:app- Open http://localhost:5000
- Login with your credentials
- Upload and manage files through intuitive interface
You can also use it with CLI utils like curl.
| Method | Path | Description |
|---|---|---|
| GET | /files | List files |
| POST | /upload | Upload file |
| GET | /download/:id | Download file |
| DELETE | /delete/:id | Delete file |
# Upload file
curl -u user:pass -F "[email protected]" http://localhost:5000/api/upload
# List files
curl -u user:pass http://localhost:5000/api/files{
"files": [
{
"name": "report.pdf",
"size": 24576,
"url": "http://localhost:5000/api/download/report.pdf"
}
]
}Run with coverage report:
pytestMIT License - see LICENSE for details.
