mirror of
https://github.com/NovaOSS/LingoSynth.git
synced 2024-11-29 12:23:58 +01:00
29 lines
588 B
Python
29 lines
588 B
Python
|
"""Flask app for the backend of the project."""
|
||
|
|
||
|
import flask
|
||
|
import flask_cors
|
||
|
import flask_limiter
|
||
|
|
||
|
from . import api, views, other
|
||
|
from authlib.integrations.flask_client import OAuth
|
||
|
|
||
|
|
||
|
app = flask.Flask(__name__)
|
||
|
oauth = OAuth(app)
|
||
|
|
||
|
limiter = flask_limiter.Limiter(
|
||
|
flask_limiter.util.get_remote_address,
|
||
|
app=app,
|
||
|
default_limits=['60 per minute', '2 per second'],
|
||
|
storage_uri='memory://',
|
||
|
strategy='fixed-window'
|
||
|
)
|
||
|
|
||
|
flask_cors.CORS(app, resources={r'/api/*': {'origins': '*'}})
|
||
|
|
||
|
app.rate_limiter = limiter
|
||
|
|
||
|
api.register(app)
|
||
|
views.register(app)
|
||
|
other.register(app)
|