推荐学习书目
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 · May 18, 2020 · 2648 views
    This topic created in 2214 days ago, the information mentioned may be changed or developed.

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

    Supplement 1  ·  May 19, 2020
    @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'
    
    
    Supplement 2  ·  May 19, 2020
    网上搜索了 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 replies    2020-05-19 14:53:47 +08:00
    Te11UA
        1
    Te11UA  
       May 19, 2020
    代码上呀
    lixuda
        2
    lixuda  
    OP
       May 19, 2020
    @Te11UA 已贴上
    Latin
        3
    Latin  
       May 19, 2020
    缓存或者 dns 建议 127.0.0.1 localhost 有时候会抽风 浏览器无痕都测试测试
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5433 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 07:51 · PVG 15:51 · LAX 00:51 · JFK 03:51
    ♥ Do have faith in what you're doing.