flask开发中遇到NameError: name 'Post' is not defi
flask开发中遇到NameError: name 'Post' is not defined --------------------------------------------------------------------------- ImportError? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Traceback (most recent call last) E:softwarepython35libsite-packagesflask_scriptcommands.py in run(self,no_ipython,no_bpython) ? ? 299? ? ? ? ? ? ? ? ? ? ?# 0.10.x --> 300? ? ? ? ? ? ? ? ? ? ?from IPython.Shell import IPShellEmbed ? ? 301? ? ? ? ? ? ? ? ? ? ?ipshell = IPShellEmbed(banner=self.banner) ImportError: No module named 'IPython.Shell' During handling of the above exception,another exception occurred: NameError? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Traceback (most recent call last) <ipython-input-1-73735930ffba> in <module>() ----> 1 Post.query.all() NameError: name 'Post' is not defined 报这个错误原因在于manager.py中没有引入Post,解决方法: from app.models import User,Role,Post def make_shell_context(): ? ? return dict(app=app,db=db,User=User,Role=Role,Post=Post) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 用python进行电位数值微分
- 将数字列表操作为列或单独的列表以便在Python中进行绘图
- python – 在GTK,GTK,GTK 3,PyGobject等之间完全混淆
- 使用SSH隧道让Django服务器认为它在AWS内部运行?
- 如何遍历一组张量并将每个组中的元素传递给函数?
- python使用multiprocessing模块实现带回调函数的异步调用方
- Python 库打包分发、setup.py 编写、混合 C 扩展打包的简易
- 如何将变量传递给django中的{%url%}标记?
- python – 如何为Xerox打印机创建动态作业单?
- python – Pandas HDFStore.create_table_index不提高选择