mirror of
https://github.com/simple-login/app.git
synced 2025-02-24 15:53:22 +08:00
small refactoring
This commit is contained in:
parent
52b5526261
commit
b690e903fa
1 changed files with 8 additions and 5 deletions
13
server.py
13
server.py
|
@ -42,7 +42,6 @@ from app.config import (
|
|||
SENTRY_FRONT_END_DSN,
|
||||
FIRST_ALIAS_DOMAIN,
|
||||
SESSION_COOKIE_NAME,
|
||||
ADMIN_EMAIL,
|
||||
PLAUSIBLE_HOST,
|
||||
PLAUSIBLE_DOMAIN,
|
||||
GITHUB_CLIENT_ID,
|
||||
|
@ -157,7 +156,7 @@ def create_app() -> Flask:
|
|||
flask_profiler.init_app(app)
|
||||
|
||||
# enable CORS on /api endpoints
|
||||
cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
|
||||
CORS(app, resources={r"/api/*": {"origins": "*"}})
|
||||
|
||||
# set session to permanent so user stays signed in after quitting the browser
|
||||
# the cookie is valid for 7 days
|
||||
|
@ -312,7 +311,7 @@ def fake_data():
|
|||
|
||||
@login_manager.user_loader
|
||||
def load_user(user_id):
|
||||
user = User.query.get(user_id)
|
||||
user = User.get(user_id)
|
||||
|
||||
return user
|
||||
|
||||
|
@ -659,14 +658,14 @@ window.location.href = "/";
|
|||
"""
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def local_main():
|
||||
app = create_app()
|
||||
|
||||
# enable flask toolbar
|
||||
app.config["DEBUG_TB_PROFILER_ENABLED"] = True
|
||||
app.config["DEBUG_TB_INTERCEPT_REDIRECTS"] = False
|
||||
app.debug = True
|
||||
toolbar = DebugToolbarExtension(app)
|
||||
DebugToolbarExtension(app)
|
||||
|
||||
# warning: only used in local
|
||||
if RESET_DB:
|
||||
|
@ -682,3 +681,7 @@ if __name__ == "__main__":
|
|||
app.run(debug=True, port=7777, ssl_context=context)
|
||||
else:
|
||||
app.run(debug=True, port=7777)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
local_main()
|
||||
|
|
Loading…
Reference in a new issue