【发布时间】:2017-12-19 22:20:40
【问题描述】:
我正在处理我的小包,我遇到了奇怪的werkzeug 问题。
问题:
当我尝试在 debug 模式下运行我的应用程序时,为了运行我的应用程序,我使用了命令python3 -m my_app --start
我收到了错误 ModuleNotFoundError: No module named '__main__.helpers'; '__main__' is not a package
文件很简单
app.py
class Application:
"""Main class"""
def __init__(self):
self.reader = ApplicationReader()
self.app = Flask(self.reader.name)
def __start_server(self):
"""Custom method, for starting flask application"""
self.app.run(debug=True)
def run(self):
"""Run the server"""
return self.__start_server()
# Instance of Application class
application = Application()
def start_app():
"""Start the mock server
"""
return application.run()
__main__.py
def cli(run, init, start):
if run:
print('Your API is running...')
if init:
create_init_file()
if start:
start_app()
if __name__ == '__main__':
cli()
而且似乎无法修复该错误,GitHub issue
那么,也许有人对此案有解决方案?谢谢。
【问题讨论】: