]>
git.gir.st - subscriptionfeed.git/blob - app/__init__.py
4 from flask
import Flask
6 from . common
. common
import *
7 from . common
. user
import init_login
10 app
. secret_key
= base64
. b64decode ( cf
[ 'frontend' ]. get ( 'secret_key' , '' )) or \
11 secrets
. token_bytes ( 16 ) # development fallback; CSRF/cookies won't persist.
14 for name
in cf
[ 'frontend' ][ 'modules' ]. split ( ',' ):
15 blueprint
= importlib
. import_module ( '.' + name
, __name__
)
16 app
. register_blueprint ( blueprint
. frontend
)
18 # TODO: should this go somewhere else?
19 # This error handler logs requests to external apis, and POST data. this makes debugging of api responses easier, as the request can be reconstructed and replayed.
20 from flask
import g
, request
21 from werkzeug
. exceptions
import InternalServerError
22 @app . errorhandler ( InternalServerError
)
24 if request
. method
== "POST" :
25 app
. logger
. error ( request
. data
)
26 if 'api_requests' in g
:
27 app
. logger
. error ( g
. api_requests
)
30 from . common
import anticsrf