Fork of Fitness app design was forked from Fork of Fitness app design
Continue chatting to ask questions about or make changes to it.
This generation may require the following integrations:
Log in
You must be logged in to connect an integration.
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead. Traceback (most recent call last): File "C:\Users\princ\FitApp\app.py", line 34, in <module> db.init_app(app) ~~~~~~~~~~~^^^^^ File "C:\Users\princ\FitApp.venv\Lib\site-packages\flask_sqlalchemy\extension.py", line 326, in init_app engines[key] = self._make_engine(key, options, app) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ File "C:\Users\princ\FitApp.venv\Lib\site-packages\flask_sqlalchemy\extension.py", line 614, in _make_engine return sa.engine_from_config(options, prefix="") ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^ File "C:\Users\princ\FitApp.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 823, in engine_from_config return create_engine(url, **options) File "<string>", line 2, in create_engine File "C:\Users\princ\FitApp.venv\Lib\site-packages\sqlalchemy\util\deprecations.py", line 281, in warned return fn(*args, **kwargs) # type: ignore[no-any-return] File "C:\Users\princ\FitApp.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 602, in create_engine dbapi = dbapi_meth(**dbapi_args) File "C:\Users\princ\FitApp.venv\Lib\site-packages\sqlalchemy\dialects\mysql\mysqldb.py", line 149, in import_dbapi return import("MySQLdb") ModuleNotFoundError: No module named 'MySQLdb' when trying to run the python app.py
I'll help you fix these issues. There are two problems:
FLASK_ENV
deprecation warningMySQLdb
moduleLet's fix both:
The changes I made:
.env
file and app.py
as a fallback. SQLite doesn't require additional drivers and works out of the box.app.py
to correctly point to the route modules (removed the src.
prefix).FLASK_ENV=development
with FLASK_DEBUG=1
in the .env
file to address the deprecation warning.Now you should be able to run the application without those errors. After making these changes, run:
pip install -r requirements.txt
python app.py
If you still want to use MySQL instead of SQLite, you would need to install the MySQL client:
pip install mysqlclient
And then change the DATABASE_URL back to your MySQL connection string.
This generation may require the following integrations:
Log in
You must be logged in to connect an integration.