日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python项目部署访问特别卡_【python新人求助】flask+pymssql 通过wsgi发布到Apache,访问接口服务器卡死?...

發布時間:2024/9/27 python 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python项目部署访问特别卡_【python新人求助】flask+pymssql 通过wsgi发布到Apache,访问接口服务器卡死?... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

前端發起http請求 '/getData' ,項目就卡死

index.py 代碼如下:

from flask import Flask,render_template,request

import json

import pymssql

import urllib.parse

import sys

app = Flask(__name__)

@app.route('/')

def index():

return render_template('index.html')

@app.route('/hello')

def hello():

return 'hello world'

@app.route('/getData',methods=['GET'])

def getddlData():

# return json.dumps([])

sql='SELECT DISTINCT ChatRoomName FROM dbo.Issue'

conn=pymssql.connect(host="localhost", user="sa", password="123456", database="IssueCollect")

cursor=conn.cursor(as_dict=True)

cursor.execute(sql)

rooms=cursor.fetchall()

cursor.close()

conn.close()

return json.dumps(rooms)

if __name__ == '__main__':

app.run()

test.wsgi:

import sys

#app's path

sys.path.insert(0,"C:/Users/Stephen/Desktop/IssueCollect")

from index import app

#Initialize WSGI app object

application = app

Apache conf

LoadFile "c:/program files (x86)/python37-32/python37.dll"

LoadModule wsgi_module "c:/program files (x86)/python37-32/lib/site-packages/mod_wsgi/server/mod_wsgi.cp37-win32.pyd"

WSGIPythonHome "c:/program files (x86)/python37-32"

WSGIScriptAlias / C:/Users/Stephen/Desktop/IssueCollect/test.wsgi

Require all granted

卡死后關閉httpd,查看Apache error log:

on Jul 23 14:05:52.534352 2018] [mpm_winnt:notice] [pid 3856:tid 600] AH00455: Apache/2.4.34 (Win32) mod_wsgi/4.6.4 Python/3.7 configured -- resuming normal operations

[Mon Jul 23 14:05:52.534853 2018] [mpm_winnt:notice] [pid 3856:tid 600] AH00456: Server built: Jul 10 2018 09:24:15

[Mon Jul 23 14:05:52.534853 2018] [core:notice] [pid 3856:tid 600] AH00094: Command line: 'C:\\Apache24\\bin\\httpd.exe -d C:/Apache24'

[Mon Jul 23 14:05:52.536599 2018] [mpm_winnt:notice] [pid 3856:tid 600] AH00418: Parent: Created child process 18044

Apache server shutdown initiated...

pm_winnt:notice] [pid 18044:tid 712] AH00354: Child: Starting 512 worker threads.

[Mon Jul 23 14:06:58.522281 2018] [mpm_winnt:notice] [pid 3856:tid 600] AH00422: Parent: Received shutdown signal -- Shutting down the server.

[Mon Jul 23 14:07:30.572310 2018] [mpm_winnt:notice] [pid 18044:tid 712] AH00362: Child: Waiting 30 more seconds for 2 worker threads to finish.

[Mon Jul 23 14:08:00.692059 2018] [mpm_winnt:notice] [pid 18044:tid 712] AH00362: Child: Waiting 0 more seconds for 2 worker threads to finish.

[Mon Jul 23 14:08:00.792357 2018] [mpm_winnt:notice] [pid 18044:tid 712] AH00363: Child: Terminating 2 threads that failed to exit.

[Mon Jul 23 14:08:00.792357 2018] [mpm_winnt:notice] [pid 18044:tid 712] AH00364: Child: All worker threads have exited.

在本地python中執行index.py訪問正常,

發布到Apache服務器上,不連接數據庫直接返回空正常。

連接數據庫就有問題。

是我Apache配置問題嗎?

總結

以上是生活随笔為你收集整理的python项目部署访问特别卡_【python新人求助】flask+pymssql 通过wsgi发布到Apache,访问接口服务器卡死?...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。