diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2013-10-23 22:59:35 +0300 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2013-10-23 22:59:50 +0300 |
| commit | 1dc7c2e4c8b764996e0677fe49a13df556b251e6 (patch) | |
| tree | 990e03bfe9907dc2d974b6982b713c435f8171d0 /app.py | |
| parent | da7f2ffd54dde225a02f47c28159f8eab5b397ef (diff) | |
Add CORS support
Diffstat (limited to 'app.py')
| -rw-r--r-- | app.py | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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']) |
