diff options
| author | 2018-05-14 20:42:41 +0100 | |
|---|---|---|
| committer | 2018-05-14 20:42:41 +0100 | |
| commit | b7fe5de12be5c9f02adeedba45befee751ea68be (patch) | |
| tree | 740be4b7dff4a8e70616e1663375ef1940604d53 /pysite/route_manager.py | |
| parent | Switch from using abort to using werkzeug exception (diff) | |
Migration runner and migrations (#69)
* Migration runner and migrations
* Remove demo wiki data
* [Staff] Table management pages
* Fix weird travis build omission
* Address review and comments by @Volcyy
* [Tables] Fix pagination
* Move table definitions to new file with nameduple
* Linting
* Address lemon's review comments
* Address @Volcyy's review
* Address lemon's review
* Update search placeholder
* Search by key now available
Diffstat (limited to 'pysite/route_manager.py')
| -rw-r--r-- | pysite/route_manager.py | 9 | 
1 files changed, 7 insertions, 2 deletions
| diff --git a/pysite/route_manager.py b/pysite/route_manager.py index 429a553e..f99a4736 100644 --- a/pysite/route_manager.py +++ b/pysite/route_manager.py @@ -6,11 +6,12 @@ import os  from flask import Blueprint, Flask, _request_ctx_stack  from flask_dance.contrib.discord import make_discord_blueprint  from flask_sockets import Sockets +from gunicorn_config import when_ready  from pysite.base_route import APIView, BaseView, ErrorView, RouteView  from pysite.constants import ( -    CSRF, DISCORD_OAUTH_AUTHORIZED, DISCORD_OAUTH_ID, DISCORD_OAUTH_REDIRECT, DISCORD_OAUTH_SCOPE, -    DISCORD_OAUTH_SECRET, PREFERRED_URL_SCHEME) +    CSRF, DEBUG_MODE, DISCORD_OAUTH_AUTHORIZED, DISCORD_OAUTH_ID, DISCORD_OAUTH_REDIRECT, +    DISCORD_OAUTH_SCOPE, DISCORD_OAUTH_SECRET, PREFERRED_URL_SCHEME)  from pysite.database import RethinkDB  from pysite.oauth import OauthBackend  from pysite.websockets import WS @@ -40,6 +41,10 @@ class RouteManager:          # to edit          self.app.config["WTF_CSRF_TIME_LIMIT"] = None +        if DEBUG_MODE: +            # Migrate the database, as we would in prod +            when_ready(output_func=self.db.log.info) +          self.app.before_request(self.db.before_request)          self.app.teardown_request(self.db.teardown_request) | 
