fix caching
This commit is contained in:
parent
ee572e1f59
commit
b35c36629f
10
app.py
10
app.py
@ -14,15 +14,19 @@ app.config.from_object(DevelopmentConfig) # Use DevelopmentConfig or Production
|
|||||||
cache = Cache(app, config={'CACHE_TYPE': 'SimpleCache'})
|
cache = Cache(app, config={'CACHE_TYPE': 'SimpleCache'})
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
@cache.cached(timeout=60) # cache for 120 seconds
|
def index():
|
||||||
def home():
|
|
||||||
# If the user is logged in, redirect to a protected page like /accounts
|
# If the user is logged in, redirect to a protected page like /accounts
|
||||||
if session.get('logged_in'):
|
if session.get('logged_in'):
|
||||||
|
return redirect(url_for('home'))
|
||||||
|
return render_template('index.html')
|
||||||
|
|
||||||
|
@app.route('/home')
|
||||||
|
@cache.cached(timeout=60) # cache for 120 seconds
|
||||||
|
def home():
|
||||||
base_url = app.config['BASE_URL'] # Access base_url from the config
|
base_url = app.config['BASE_URL'] # Access base_url from the config
|
||||||
all_accounts = get_user_accounts(base_url, session['auth_credentials'])
|
all_accounts = get_user_accounts(base_url, session['auth_credentials'])
|
||||||
current_month_accounts = filter_accounts_current_month(all_accounts)
|
current_month_accounts = filter_accounts_current_month(all_accounts)
|
||||||
return render_template('home.html', username=session['username'], accounts=get_user_accounts(base_url, session['auth_credentials']), current_month_accounts=current_month_accounts)
|
return render_template('home.html', username=session['username'], accounts=get_user_accounts(base_url, session['auth_credentials']), current_month_accounts=current_month_accounts)
|
||||||
return render_template('index.html')
|
|
||||||
|
|
||||||
@app.route('/login', methods=['POST'])
|
@app.route('/login', methods=['POST'])
|
||||||
def login():
|
def login():
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user