From bc11283c5c80701fd28ee7fdd936ff78794bf1fb Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Thu, 16 Aug 2012 20:18:52 +0300 Subject: initial commit --- app.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 app.py (limited to 'app.py') diff --git a/app.py b/app.py new file mode 100644 index 0000000..000393f --- /dev/null +++ b/app.py @@ -0,0 +1,38 @@ +import os + +from flask import Flask +from flask import render_template +from flask.ext.sqlalchemy import SQLAlchemy + +app = Flask(__name__) +app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['HEROKU_POSTGRESQL_COLOR_URL'] +db = SQLAlchemy(app) + + +class User(db.Model): + id = db.Column(db.Integer, primary_key=True) + name = db.Column(db.String(80)) + email = db.Column(db.String(120), unique=True) + + def __init__(self, name, email): + self.name = name + self.email = email + + def __repr__(self): + return '' % self.name + + +@app.route('/') +def home(): + return render_template('index.html') + + +@app.route('/robots.txt') +def robots(): + res = app.make_response('User-agent: *\nAllow: /') + res.mimetype = 'text/plain' + return res + +if __name__ == '__main__': + port = int(os.environ.get('PORT', 5000)) + app.run(host='0.0.0.0', port=port, debug=True) -- cgit v1.3.1