Skip to content

A micropub media endpoint written in Python using Flask and Flask-HashFS

License

Notifications You must be signed in to change notification settings

martymcguire/spano

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spano

A minimum viable Micropub Media Endpoint implementation built on Python, Flask and Flask-HashFS. Uses Flask-IndieAuth to support authentication with IndieAuth.

Quick (& Dirty) Start

How to run your own instance of Spano.

git clone https://github.com/martymcguire/spano.git
cd spano

Create and activate a virtualenv:

virtualenv --python=/usr/bin/python3 venv
source venv/bin/activate

or conda:

conda create -n spano python=3.5
source activate spano

Install required Python libraries

pip install -r requirements.txt

Copy spano.cfg.template to spano.cfg and edit it to check the values of ME, TOKEN_ENDPOINT

Run the dev server

python run.py

You can test out the server with curl, but you'll need a valid IndieAuth token to authenticate. One way to get one is to log in with Quill and visit the Quill settings page, where you can copy the access token.

To perform a test upload with curl:

curl -D - -F "file=@myfile.jpg" \
  -H"Authorization: Bearer xxxx..." \
  localhost:5000/

You should see output like:

HTTP/1.1 100 Continue

HTTP/1.0 201 CREATED
Content-Type: text/html; charset=utf-8
Content-Length: 108
Location: http://localhost:5000/cc/a5/97/7c/20049317385a31319590e39c8693638bb368767a76faf0735b6dd2cb.jpg
Server: Werkzeug/0.11.4 Python/2.7.11
Date: Thu, 26 Jan 2017 02:40:05 GMT

File created: http://localhost:5000/cc/a5/97/7c/20049317385a31319590e39c8693638bb368767a76faf0735b6dd2cb.jpg

Deployment

Spano needs a webserver like Apache or nginx for serving the actual file content, and to act as a proxy for virtualhost support, HTTPS, etc.

These instructions are generic but hopefully a good starting place:

uwsgi

When the package is installed in global Python path, one can make uWSGI serve it using an expression spano:create_app("/etc/spano.cfg"), where /etc/spano.cfg is an absolute path to Spano config. You can use --mount to mount the app somewhere.

The Name?

Jessie Spano was the most organized character on Saved by the Bell and the only one I would trust to keep my files in order.

About

A micropub media endpoint written in Python using Flask and Flask-HashFS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages