Skip to content

Commit

Permalink
fix api tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kgarbacinski committed May 16, 2024
1 parent 8cf2143 commit aa454c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 1 addition & 5 deletions backend/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create_app(config=None):
template_folder=f"{config.PROJECT_ROOT}/templates",
static_folder=f"{config.PROJECT_ROOT}/static",
)
app.teardown_request(teardown_session)

app.config.from_object(config)

register_extensions(app)
Expand All @@ -58,7 +58,3 @@ def register_extensions(app):
def register_errorhandlers(app):
handler = ExceptionHandler()
app.register_error_handler(Exception, handler)


def teardown_session(*args, **kwargs):
db.session.remove()
7 changes: 7 additions & 0 deletions backend/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# we prevent this monkeypatching

import os
from app.extensions import db

os.environ["EVENTLET_NO_GREENDNS"] = "yes"
import eventlet # noqa
Expand All @@ -20,5 +21,11 @@

app = create_app()


@app.teardown_request
def teardown_session(*args, **kwargs):
db.session.remove()


if __name__ == "__main__":
eventlet.wsgi.server(eventlet.listen(("0.0.0.0", 5000)), app, log=app.logger)

0 comments on commit aa454c6

Please sign in to comment.