ฉันตั้งค่า mod_wsgi บนเซิร์ฟเวอร์ ubuntu/apache2 ของฉัน
ฉันพยายามเรียกใช้เธรด แต่ daemons ไม่ทำงาน
เมื่อฉันพยายามเรียกใช้ในพื้นหลัง ไม่มีอะไรเกิดขึ้น
สคริปต์ wsgi ของฉัน:
นำเข้า sys, บันทึก
sys.path.insert(0, "/var/www/xxx/public_html/blockchain/")
จากแอปนำเข้าแอปเป็นแอปพลิเคชัน
logging.basicConfig(ชื่อไฟล์'/var/www/xxx/blockchain/wsgi.log', level=logging.INFO, filemode='w')
ไฟล์ xxx.conf ของฉันคือ:
ฟัง 8888
<โฮสต์เสมือน *:8888>
        ชื่อเซิร์ฟเวอร์ xxx.com
        ServerAlias xxx.com
        ErrorLog /var/www/xxx/logs/error.log
        รวม CustomLog /var/www/xxx/logs/acccess.log
        ผู้ใช้ WSGIDaemonProcess xxx=www-data group=www-data process=5 threads=10
        WSGIProcessGroup xxx
        WSGIApplicationGroup %{GLOBAL}
        WSGIScriptAlias / /var/www/xxx/public_html/blockchain/xxx.wsgi
        นามแฝง /static/ /var/www/xxx/public_html/blockchain/static
        <ไดเรกทอรี /var/www/xxx/public_html/blockchain>
                คำสั่งอนุญาตปฏิเสธ
                อนุญาตจากทั้งหมด
        </ไดเร็กทอรี>
</เวอร์ชวลโฮสต์>
ส่วนที่เกี่ยวข้องของสคริปต์หลามของฉันคือ:
ถ้า __name__ == '__main__':
    t1 = threading.Thread(target=doFirstThing, daemon=True)
    t2 = threading.Thread(target=doSecondThing, daemon=True)
    t3 = threading.Thread(target=doThirdThing, daemon=True)
    t1.start()
    t2.start()
    t3.start()
    app.run(host='0.0.0.0', port='8888', debug=True)
ฉันจะทำให้เธรดทำงานในพื้นหลังได้อย่างไร เมื่อเปิดไฟล์ Flask โดยใช้ wsgi
ขอบคุณ