Skip to content

Instantly share code, notes, and snippets.

@davidadamojr
Last active June 22, 2021 13:17
Show Gist options
  • Select an option

  • Save davidadamojr/465de1f5f66334c91a4c to your computer and use it in GitHub Desktop.

Select an option

Save davidadamojr/465de1f5f66334c91a4c to your computer and use it in GitHub Desktop.

Revisions

  1. davidadamojr revised this gist Sep 15, 2016. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion server.py
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,5 @@
    from flask import Flask
    from flask.ext import restful
    from flask.ext.restful import Api
    from flask.ext.sqlalchemy import SQLAlchemy

    app = Flask(__name__)
  2. davidadamojr renamed this gist Jan 8, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. davidadamojr revised this gist Jan 8, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion cors.py
    Original file line number Diff line number Diff line change
    @@ -17,4 +17,6 @@ def after_request(response):
    response.headers.add('Access-Control-Allow-Origin', '*')
    response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
    response.headers.add('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE')
    return response
    return response

    import views
  4. davidadamojr created this gist Jan 8, 2015.
    20 changes: 20 additions & 0 deletions cors.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    from flask import Flask
    from flask.ext import restful
    from flask.ext.restful import Api
    from flask.ext.sqlalchemy import SQLAlchemy

    app = Flask(__name__)
    app.config.from_object('config')

    #flask-sqlalchemy
    db = SQLAlchemy(app)

    #flask-restful
    api = restful.Api(app)

    @app.after_request
    def after_request(response):
    response.headers.add('Access-Control-Allow-Origin', '*')
    response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
    response.headers.add('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE')
    return response