I just started using the new beta version of CS50 IDE. I tried to run my final project from last year, but when I run Flask I get the following message:

"DeprecationWarning: 'werkzeug.contrib.cache' is deprecated as of version 0.15 and will be removed in version 1.0. It has moved to https://github.com/pallets/cachelib."

When I run Flask on the older IDE, with the exact same code, everything works fine.

Just FYI, I am importing the following in application.py:

import os
import sqlite3
import csv

from cs50 import SQL
from flask import Flask, flash, redirect, render_template, request, session, send_from_directory, send_file, after_this_request, url_for, Request
from flask_session import Session
from tempfile import mkdtemp
from werkzeug.exceptions import default_exceptions
from werkzeug.security import check_password_hash, generate_password_hash
from werkzeug.utils import secure_filename

and in helpers.py:

import requests
import urllib.parse
import ast
import csv
import os

from flask import redirect, render_template, request, session
from functools import wraps
from cs50 import SQL

I already installed cachelib ("pip install -U cachelib") as suggested from the link in the error message.

Thanks in advance for the help


Not having seen the rest of your application.py code, I'm going to assume you have something like this:

# Configure CS50 Library to use SQLite database
 db = SQL("sqlite:///database.db")

near the top. If so, make sure that it comes after your line


Another student had this deprecation issue and, for some reason I don't yet understand, if the db is set before you run Session(app) you get this error, but if it's moved directly after, you don't.

  • Thank you so much cusiouskiwi, you are a life saver. The problem was actually in the helper.py code. As you mentioned, I had the """db = SQL("sqlite:///database.db")""" code at the top. After moved it and put inside the only function that was using it, it worked fine. Thanks a lot!
    – Student1
    Jul 24 '19 at 1:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .