flask启动成功,访问报错

讨论 未结
6 94
wxf8602
wxf8602 14天前
使用flask run启动能成功,访问http://127.0.0.1:5000/报错: ValueError ValueError: path is on mount 'e:', start on mount 'c:' Traceback (most recent call last) File "C:\Users\wangxufei\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 2464, in __call__ return self.wsgi_app(environ, start_response) File "C:\Users\wangxufei\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 2450, in wsgi_app response = self.handle_exception(e) File "C:\Users\wangxufei\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 1867, in handle_exception reraise(exc_type, exc_value, tb) File "C:\Users\wangxufei\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\_compat.py", line 39, in reraise Open an interactive python shell in this frameraise value
回帖
  • wxf8602
    wxf8602 (楼主)
    14天前
    @mkg 现在似乎创建了虚拟环境,现在flask run启动后,访问报错有变化, flask.cli.NoAppException: While importing "main", an ImportError was raised: Traceback (most recent call last): File "C:\Users\wangxufei\Anaconda3\lib\site-packages\flask\cli.py", line 240, in locate_app __import__(module_name) File "C:\Users\wangxufei\PycharmProjects\pear-admin-flask\main.py", line 2, in <module> from flask_uploads import configure_uploads, patch_request_class File "C:\Users\wangxufei\Anaconda3\lib\site-packages\flask_uploads.py", line 26, in <module> from werkzeug import secure_filename, FileStorage ImportError: cannot import name 'secure_filename' from 'werkzeug' (C:\Users\wangxufei\Anaconda3\lib\site-packages\werkzeug\__init__.py)
    0 回复
  • mkg
    14天前
    @wxf8602 创建虚拟环境后需要激活使用,百度一下教程就可以
    0 回复
  • wxf8602
    wxf8602 (楼主)
    14天前
    @mkg 按教程执行过 python -m venv venv,能私聊嘛? 181 1256 8651
    0 回复
  • mkg
    14天前
    @wxf8602 安装的依赖位置不统一造成的,推荐使用venv安装
    0 回复
  • wxf8602
    wxf8602 (楼主)
    14天前
    @mkg 不为anaconda
    0 回复
  • mkg
    14天前
    环境是否为anaconda?
    0 回复