V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
lixuda
V2EX  ›  Python

flask 本地环境 测试 post 加载慢

  •  
  •   lixuda · 2020-05-18 22:43:35 +08:00 · 1817 次点击
    这是一个创建于 1433 天前的主题,其中的信息可能已经有所发展或是发生改变。

    尝试下 flask,发现很简单 post 页面,但是一直加载,本地默认 app.run(debug = True) 上传服务器,nignx+Gunicorn 部署,没有问题。很奇怪,测试环境再慢,我也是单页面打开测试,为什么会有这个问题?小白求教

    第 1 条附言  ·  2020-05-19 12:42:12 +08:00
    @app.route('/login',methods=['GET','POST'])
    def login():
         if(request.method == 'POST'):
            uname = request.form.get('username','')
            upwd = request.form.get('password','')
            if(uname=='u' and upwd=='p'):
                return 'login'
            else:
                return 'error'
    
    
    第 2 条附言  ·  2020-05-19 12:48:27 +08:00
    网上搜索了 1 圈,

    After you've open URL with Chrome/Chromium -- Flask will hang and won't respond to other clients (curl, postman, firefox, python-request, ..).

    Workaround for Chrome
    Disable URL-prediction services in Chrome/Chromium (Actual names of options are on the screenshot)
    3 条回复    2020-05-19 14:53:47 +08:00
    Te11UA
        1
    Te11UA  
       2020-05-19 11:31:15 +08:00
    代码上呀
    lixuda
        2
    lixuda  
    OP
       2020-05-19 12:42:32 +08:00
    @Te11UA 已贴上
    Latin
        3
    Latin  
       2020-05-19 14:53:47 +08:00
    缓存或者 dns 建议 127.0.0.1 localhost 有时候会抽风 浏览器无痕都测试测试
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1686 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 16:40 · PVG 00:40 · LAX 09:40 · JFK 12:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.