From 1dc7c2e4c8b764996e0677fe49a13df556b251e6 Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Wed, 23 Oct 2013 22:59:35 +0300 Subject: Add CORS support --- app.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app.py') diff --git a/app.py b/app.py index 4eb4766..fafeb73 100644 --- a/app.py +++ b/app.py @@ -5,6 +5,8 @@ from flask.ext.sqlalchemy import SQLAlchemy from os import environ +from cors import crossdomain + app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = environ.get('DATABASE_URL', 'postgres://localhost:5432/traces') @@ -31,6 +33,7 @@ class Trace(db.Model): class Traces(restful.Resource): + @crossdomain(origin='*') def get(self): traces = Trace.query.order_by(Trace.id.desc()).limit(3) return [{ @@ -38,6 +41,7 @@ class Traces(restful.Resource): 'trace': trace.trace } for trace in traces] + @crossdomain(origin='*') def post(self): args = trace_parser.parse_args() trace = Trace(args['page'], args['trace']) -- cgit v1.3.1