Merge conflic: Update app.py

This commit is contained in:
Teddy-1024
2025-01-25 16:05:07 +00:00
committed by GitHub
parent 2461aef77b
commit d07f409426

28
app.py
View File

@@ -20,7 +20,7 @@ from config import app_config, Config
from controllers.core import routes_core
from controllers.legal import routes_legal
from controllers.user import routes_user
from extensions import db, csrf, cors, mail, oauth
from extensions import db, csrf, mail, oauth
from helpers.helper_app import Helper_App
# external
from flask import Flask, render_template, jsonify, request, render_template_string, send_from_directory, redirect, url_for, session
@@ -81,12 +81,13 @@ def make_session_permanent():
session.permanent = True
csrf = CSRFProtect()
"""
cors = CORS()
db = SQLAlchemy()
mail = Mail()
oauth = OAuth()
"""
cors = CORS(app, resources={
r"/static/*": {
"origins": [app.config["URL_HOST"]],
"methods": ["GET"],
"max_age": 3600
}
})
csrf.init_app(app)
cors.init_app(app)
@@ -123,3 +124,16 @@ app.register_blueprint(routes_user)
def console_log(value):
Helper_App.console_log(value)
return value
<<<<<<< HEAD
@app.after_request
def add_cache_headers(response):
if request.path.startswith('/static/'):
# Cache static assets
response.headers['Cache-Control'] = 'public, max-age=31536000'
else:
# No caching for dynamic content
response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'
return response
=======
>>>>>>> a5d77c11a435413c35315fe1c53b778a454279c8