首页 > 解决方案 > Flask + Heroku:H12 请求超时错误

问题描述

我有一个 Heroku 应用程序来运行 Scrapy Spider。启动后,我收到错误 H12。如何解决?

查询:

$.post('/wellness', {'specialty': specialty, 'state': state, 'city': city}, (res) => { 
      $(location).attr('href', 'http://127.0.0.1:5000/wellness')
    });

烧瓶:

if request.method == 'POST':
    specialty = request.form.getlist('specialty[]')
    state = request.form.getlist('state[]')
    city = request.form.getlist('city[]')

    settings = ''
    with open(file_json, 'r') as f:
        for line in f.read():
            settings += line

    settings = json.loads(settings)
    settings['specialty'] = specialty
    settings['state'] = state
    settings['city'] = city

    with open(file_json, 'w') as f:
        f.write(json.dumps(settings, indent=4))

    process = subprocess.Popen('python spiders/' + file_py, shell=True)
    process.wait()

return render_template(file_html)

标签: javascriptflaskheroku

解决方案


推荐阅读