Created
September 18, 2012 07:36
-
-
Save gronnbeck/3741809 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask | |
| import couchdb as couch | |
| from uuid import uuid4 | |
| # set up db connection / a localhost connection | |
| server = couch.Server() | |
| db = server["short_url"] | |
| # set up flask app | |
| app = Flask(__name__) | |
| @app.route("/s/<hash>") | |
| def short_url: | |
| obj = db[hash] | |
| return redirect(obj.url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment