Skip to content

Commit

Permalink
update: set SESSION_COOKIE_SECURE.
Browse files Browse the repository at this point in the history
  • Loading branch information
Horbin-Magician committed Apr 15, 2024
1 parent 9d3827f commit 746db62
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion back-end/www/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import os
from flask import Flask
from flask_cors import CORS

from .bp_api import api

app = Flask(__name__) # 创建app
app.config.from_object("www.settings.DevelopmentConfig") # 配制app

# 配制app
is_debug_mode = os.environ.get('FLASK_DEBUG', 'true').lower() == 'true'
if is_debug_mode: app.config.from_object("www.settings.DevelopmentConfig")
else: app.config.from_object("www.settings.ProductionConfig")

app.register_blueprint(api, url_prefix='/api') # 注册蓝图api
cors = CORS(app, supports_credentials=True) # 允许跨域
1 change: 1 addition & 0 deletions back-end/www/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class BaseConfig(object):

class ProductionConfig(BaseConfig):
DEBUG = False
SESSION_COOKIE_SECURE = True

class DevelopmentConfig(BaseConfig):
pass
Expand Down

0 comments on commit 746db62

Please sign in to comment.