Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 尝试从flask应用加载页面时,浏览器挂起_Python_Flask_Sqlalchemy - Fatal编程技术网

Python 尝试从flask应用加载页面时,浏览器挂起

Python 尝试从flask应用加载页面时,浏览器挂起,python,flask,sqlalchemy,Python,Flask,Sqlalchemy,我正在创建一个web应用程序,其中列出了艺术家、场地和演出。当用户单击列表中的某个场馆时,应将其带到该场馆的页面。相反,它只是挂起。它从不从场馆列表页面移动,浏览器中的加载栏开始加载,但会以15-20%的速度挂起。没有返回错误,我已经等了几分钟,但它就是不动 我正在发布路线代码,但如果有必要,您也可以查看完整代码 @app.route('/venues/<int:venue_id>') def show_venue(venue_id): # shows the venue pag

我正在创建一个web应用程序,其中列出了艺术家、场地和演出。当用户单击列表中的某个场馆时,应将其带到该场馆的页面。相反,它只是挂起。它从不从场馆列表页面移动,浏览器中的加载栏开始加载,但会以15-20%的速度挂起。没有返回错误,我已经等了几分钟,但它就是不动

我正在发布路线代码,但如果有必要,您也可以查看完整代码

@app.route('/venues/<int:venue_id>')
def show_venue(venue_id):
  # shows the venue page with the given venue_id
  # TODO: replace with real venue data from the venues table, using venue_id
  # NOT WORKING YET
  
  # query db for the venue's ID
  venuequery = Venue.query.get(venue_id)

  # if it finds a venue with that ID
  if venuequery:
    venue_details = Venue

    data = {
      "id": venue_details.id, 
      "name": venue_details.name, 
      "genres": venue_details.genres, 
      "addres": venue_details.address, 
      "city": venue_details.city, 
      "state": venue_details.state, 
      "phone": venue_details.phone, 
      "website": venue_details.website, 
      "facebook_link": venue_details.facebook_link, 
      "seeking_talent": venue_details.seeking_talent, 
      "seeking_description": venue_details.seeking_description, 
      "image_link": venue_details.image_link, 
      }
     return render_template('pages/show_venue.html', venue=data)
用这个

# if it finds a venue with that ID
  if venuequery:
    venue_details = venuequery          # Pass class object instead of class itself
而不是这个

# if it finds a venue with that ID
  if venuequery:
    venue_details = Venue

假设您想从db访问第一个场馆。你能把venuquery的值发给我吗?你能在返回报表之前打印数据吗。“我想确定您是否正确构建了数据。@cagta编辑了这篇文章,以包含打印的内容
# if it finds a venue with that ID
  if venuequery:
    venue_details = Venue