summaryrefslogtreecommitdiff
path: root/app.py
diff options
context:
space:
mode:
authorYuval Adam <yuv.adm@gmail.com>2012-08-16 20:18:52 +0300
committerYuval Adam <yuv.adm@gmail.com>2012-08-16 20:18:52 +0300
commitbc11283c5c80701fd28ee7fdd936ff78794bf1fb (patch)
treeebfee8e0c50e29b49c4f13f6900d90faf71309fc /app.py
initial commit
Diffstat (limited to 'app.py')
-rw-r--r--app.py38
1 files changed, 38 insertions, 0 deletions
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 '<Name %r>' % 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)