Skip to content

Instantly share code, notes, and snippets.

@dahlia
Created June 20, 2012 16:57
Show Gist options
  • Save dahlia/2960924 to your computer and use it in GitHub Desktop.
Save dahlia/2960924 to your computer and use it in GitHub Desktop.
Using Wand on Heroku

Using Wand on Heroku

Add Wand into requirements.txt file, and simply import wand. It would just work. (See requirements.txt in this repository.)

from os import environ
from flask import Flask
from wand.image import Image
app = Flask(__name__)
@app.route('/')
def hi():
with Image(filename='iu.jpg') as i:
return 'width: {0}, height: {1}'.format(i.width, i.height)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=int(environ.get('PORT', 5000)))
web: python app.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment