如何构建GUI,以便在单击按钮时可以运行我的flask应用程序并在本地主机上启动MongoDB服务器?
我尝试使用.bat文件执行相同操作,但它给出了错误
------ main.bat ----
cd C:\Users\kunjm\Desktop\Drives\Projects\Kaku Office\ && CALL C:\Users\kunjm\phase_flask1\Scripts\activate.bat && set FLASK_APP=phase_flask1/src.run && set FLASK_ENV=development && flask run
但是它给出了以下错误
C:\Users\kunjm\Desktop>cd C:\Users\kunjm\Desktop\Drives\Projects\Kaku Office\ && py -m venv C:\Users\kunjm\phase_flask1 && CALL phase_flask1\Scripts\activate.bat && set FLASK_APP=phase_flask1/src.run && set FLASK_ENV=development && flask run
* Serving Flask app "phase_flask1/src.run "
* Environment: development
* Debug mode: off
Usage: flask run [OPTIONS]
Error: While importing "src.run", an ImportError was raised:
Traceback (most recent call last):
File "c:\users\kunjm\appdata\local\programs\python\python35\lib\site-packages\werkzeug\utils.py", line 418, in import_string
__import__(import_name)
ImportError: No module named 'config'
在处理上述异常期间,发生了另一个异常:
Traceback (most recent call last):
File "c:\users\kunjm\appdata\local\programs\python\python35\lib\site-packages\flask\cli.py", line 235, in locate_app
__import__(module_name)
File "C:\Users\kunjm\Desktop\Drives\Projects\Kaku Office\phase_flask1\src\run.py", line 1, in <module>
from src.app import app
File "C:\Users\kunjm\Desktop\Drives\Projects\Kaku Office\phase_flask1\src\app.py", line 8, in <module>
app.config.from_object('config')
File "c:\users\kunjm\appdata\local\programs\python\python35\lib\site-packages\flask\config.py", line 170, in from_object
obj = import_string(obj)
File "c:\users\kunjm\appdata\local\programs\python\python35\lib\site-packages\werkzeug\utils.py", line 443, in import_string
sys.exc_info()[2])
File "c:\users\kunjm\appdata\local\programs\python\python35\lib\site-packages\werkzeug\_compat.py", line 137, in reraise
raise value.with_traceback(tb)
File "c:\users\kunjm\appdata\local\programs\python\python35\lib\site-packages\werkzeug\utils.py", line 418, in import_string
__import__(import_name)
werkzeug.utils.ImportStringError: import_string() failed for 'config'. Possible reasons are:
- missing __init__.py in a package;
- package or module path not included in sys.path;
- duplicated package or module name taking precedence in sys.path;
- missing module, class, function or variable;
Debugged import:
- 'config' not found.
Original exception:
ImportError: No module named 'config'
此处python不在虚拟环境中运行,而是调用主要的python脚本