|
@@ -0,0 +1,33 @@
|
|
|
+#!/usr/bin/env python3
|
|
|
+# -*- coding: utf-8 -*-
|
|
|
+"""
|
|
|
+Created on Sun Jul 14 11:50:51 2019
|
|
|
+
|
|
|
+@author: dagarcos
|
|
|
+"""
|
|
|
+
|
|
|
+import os
|
|
|
+from flask import Flask, flash, render_template, redirect, request, url_for
|
|
|
+from flask_cors import CORS, cross_origin
|
|
|
+from models.db import db
|
|
|
+from controllers.mainController import mainController
|
|
|
+
|
|
|
+app = Flask(__name__)
|
|
|
+app.secret_key = os.urandom(12)
|
|
|
+app.config['SQLALCHEMY_DATABASE_URI'] = ""
|
|
|
+app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
|
|
|
+db.init_app(app)
|
|
|
+
|
|
|
+app.register_blueprint(mainController)
|
|
|
+CORS(app, origins = "*", allow_headers=["Content-Type", "content-type", "Authorization", "Access-Control-Allow-Credentials", "Access-Control-Allow-Headers", "Access-Control-Allow-Origin"], supports_credentials=True)
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ app.run(host='0.0.0.0', debug=True)
|
|
|
+
|
|
|
+@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,OPTIONS')
|
|
|
+
|
|
|
+ return response
|