Add Quart-CORS

This commit is contained in:
Luna Mendes 2018-07-06 03:17:38 -03:00
parent 545d261bdd
commit 6d8af8aef3
3 changed files with 15 additions and 4 deletions

View File

@ -9,6 +9,7 @@ itsdangerous = "==0.24"
asyncpg = "==0.16.0"
websockets = "==5.0.1"
Quart = "==0.6.0"
Quart-CORS = "==0.1.0"
Earl-ETF = "==2.1.2"
logbook = "*"
Cerberus = "==1.2"

16
Pipfile.lock generated
View File

@ -1,18 +1,18 @@
{
"_meta": {
"hash": {
"sha256": "bb7c65515934e11ebf3b17724f95fb8f1740a9c5aecb9bc2e8802bb54fa43574"
"sha256": "d694bb36e4b3132a613726426512430fdb235b478e17ce6fea224dae9f1a67df"
},
"host-environment-markers": {
"implementation_name": "cpython",
"implementation_version": "3.6.5",
"implementation_version": "3.6.6",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_python_implementation": "CPython",
"platform_release": "4.17.2-1-ARCH",
"platform_system": "Linux",
"platform_version": "#1 SMP PREEMPT Sat Jun 16 11:08:59 UTC 2018",
"python_full_version": "3.6.5",
"python_full_version": "3.6.6",
"python_version": "3.6",
"sys_platform": "linux"
},
@ -75,7 +75,7 @@
},
"hypercorn": {
"hashes": [],
"version": "==0.1.0"
"version": "==0.2.2"
},
"hyperframe": {
"hashes": [],
@ -105,10 +105,18 @@
"hashes": [],
"version": "==2.18"
},
"pytoml": {
"hashes": [],
"version": "==0.1.18"
},
"quart": {
"hashes": [],
"version": "==0.6.0"
},
"quart-cors": {
"hashes": [],
"version": "==0.1.0"
},
"six": {
"hashes": [],
"version": "==1.11.0"

2
run.py
View File

@ -5,6 +5,7 @@ import asyncpg
import logbook
import websockets
from quart import Quart, g, jsonify
from quart_cors import cors
from logbook import StreamHandler, Logger
from logbook.compat import redirect_logging
@ -25,6 +26,7 @@ redirect_logging()
def make_app():
app = Quart(__name__)
app = cors(app)
app.config.from_object(f'config.{config.MODE}')
is_debug = app.config.get('DEBUG', False)
app.debug = is_debug