Unexpected error: 'FlaskDB' object has no attribute 'create_table'
stmotw opened this issue · comments
Timofey Urbanovich commented
When I try to run python manage.py initdb
I get
Unexpected error: 'FlaskDB' object has no attribute 'create_tables'
Some inspecting in python:
from playhouse.flask_utils import FlaskDB
dir(FlaskDB)
['Model', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new_
_', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_load_database',
'_load_from_config_dict', '_register_handlers', 'close_db', 'connect_db', 'get_model_class', 'init_app']```
Timofey Urbanovich commented
You should call
User.create_table()
instead of
db.create_tables([User])