Skip to content

db.init_app duplicated in debug file #5

@samchappel

Description

@samchappel

Canvas Link

https://learning.flatironschool.com/courses/6259/assignments/233439?module_item_id=547397

Concern

There is a part of this lab that asks your to run python debug.py to enter the interactive shell and enter the following code:
game = Game.query.first() game.to_dict() => Can not serialize type:Review => Can not serialize type:Review => Can not serialize type:Review => {'title': 'Beat go these.', 'created_at': '2022-09-12 16:45:47', 'id': 1, 'genre': 'Racing', 'platform': 'NES', 'reviews': [], 'price': 29, 'updated_at': None}

There is a duplicate db.init_app in the debug file that is causing this error when you try to run python debug.py:
Traceback (most recent call last):
File “debug.py”, line 10, in
db.init_app(app)
File “/Users/stevepassarelli/Development/code/phase-4/python-p4-building-get-api/.venv/lib/python3.8/site-packages/flask_sqlalchemy/extension.py”, line 253, in init_app
raise RuntimeError(
RuntimeError: A ‘SQLAlchemy’ instance has already been registered on this Flask app. Import and use that instance instead.
(python-p4-building-get-api) stevepassarelli@steves-MacBook-Pro server % python debug.py

I know troubleshooting is good practice, but when this material is still so new to us and presented in a way that isn't functional, it makes it hard to know if we're doing something wrong.

Additional Context

No response

Suggested Changes

No response

Metadata

Metadata

Assignees

Labels

se curriculumIssue for lessons in the Software Engineering program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions