Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

直接运行models.py会报错 #3

Open
codeliuyang opened this issue Jan 5, 2019 · 8 comments
Open

直接运行models.py会报错 #3

codeliuyang opened this issue Jan 5, 2019 · 8 comments

Comments

@codeliuyang
Copy link

今天clone下来,直接运行
python models.py
会报错。

改正方法:
注释其中两行
#from app import login_manager
#@login_manager.user_loader

即可运行成功,把表插入数据库。

记得之后把注释取消掉

@shizi599
Copy link

shizi599 commented Jan 9, 2019

我也遇到了类似问题,你说的注释的方法不管用啊。
我运行:python models.py
报一下错误:
File "models.py", line 8, in<< module>>
from conf import config
ImportError: No module named conf

@codeliuyang
Copy link
Author

第8行,应该是下面的吧?
from conf.config import config
你的提示为什么是
from conf import config

@shizi599
Copy link

shizi599 commented Jan 9, 2019

是的错误如下,请问您知道怎么解决吗?
File "models.py", line 8, in module
from conf.config import config
ImportError: No module named conf.config

@bugbeta
Copy link

bugbeta commented Jan 12, 2019

是的错误如下,请问您知道怎么解决吗?
File "models.py", line 8, in module
from conf.config import config
ImportError: No module named conf.config

他网站说了,要把 models.py 拷到上一级目录就可运行的。

@lxyeternal
Copy link

请问我的报错这样
from conf.config import config
ImportError: No module named conf.config

model.py以及__init__.py都有conf.config,不知道具体怎么操作这两个py文件才可以解决这个问题

@kkroid
Copy link

kkroid commented Aug 15, 2019

同问

@hypchina
Copy link

hypchina commented Jul 1, 2020

app_init_.py 中修改
log_file_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(file))), 'conf/log-app.conf')
fileConfig(log_file_path, disable_existing_loggers=False)

@Togal
Copy link

Togal commented Jul 1, 2020

@codeliuyang 的方法亲试可以

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants