점프 투 플라스크/ 58쪽 flask db migrate

안녕하세요.
점프 투 플라스크 57-58쪽에서,
리비전 파일 생성을 위해서
flask db migrate 명령 수행을 했는데, 아래처럼
AttributeError: 'SQLAlchemy' object has no attribute 'Test' 라는 에러가 뜨고
리비전 파일 생성이 되지 않습니다. ㅠㅠ

(myproject) c:\projects\myproject>flask db migrate
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\ProgramData\Anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\venvs\myproject\Scripts\flask.exe\__main__.py", line 9, in <module>
  File "c:\venvs\myproject\lib\site-packages\flask\cli.py", line 967, in main
    cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None)
  File "c:\venvs\myproject\lib\site-packages\flask\cli.py", line 586, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "c:\venvs\myproject\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\venvs\myproject\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\venvs\myproject\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\venvs\myproject\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\venvs\myproject\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\venvs\myproject\lib\site-packages\click\decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\venvs\myproject\lib\site-packages\flask\cli.py", line 425, in decorator
    with __ctx.ensure_object(ScriptInfo).load_app().app_context():
  File "c:\venvs\myproject\lib\site-packages\flask\cli.py", line 388, in load_app
    app = locate_app(self, import_name, name)
  File "c:\venvs\myproject\lib\site-packages\flask\cli.py", line 257, in locate_app
    return find_best_app(script_info, module)
  File "c:\venvs\myproject\lib\site-packages\flask\cli.py", line 83, in find_best_app
    app = call_factory(script_info, app_factory)
  File "c:\venvs\myproject\lib\site-packages\flask\cli.py", line 119, in call_factory
    return app_factory()
  File "C:\projects\myproject\pybo\__init__.py", line 17, in create_app
    from . import models
  File "C:\projects\myproject\pybo\models.py", line 9, in <module>
    class Answer(db.Model):
  File "C:\projects\myproject\pybo\models.py", line 14, in Answer
    content = db.Column(db.Test(), nullable=False)
AttributeError: 'SQLAlchemy' object has no attribute 'Test'

likemika 792

M 2021년 1월 19일 4:31 오후

목록으로
1개의 답변이 있습니다. 1 / 1 Page

안녕하세요.

models.py 파일에서

content = db.Column(db.Test(), nullable=False)

대신

content = db.Column(db.Text(), nullable=False)

로 변경해 보세요.

박응용

2021년 1월 19일 4:33 오후