간단한 플라스크 앱을 실행하려고 시도했지만 다음 문제를 극복 할 수 없습니다.
내 폴더 구조부터 시작하겠습니다.
두 개의 파이썬 파일이있는 D : \ Git \ tools \ scripts \ simUserInterface :
app.py
templates.py
또한 폴더가 있습니다.
D : \ Git \ tools \ scripts \ simUserInterface \ index
web.wsgi 파일 로
내 web.wsgi 는 다음과 같습니다.
import sys
sys.path.insert(0, 'D:/Git/tools/scripts/simUserInterface')
from dashy import server as application
app.py 자체는 다음과 같습니다
import os
import sys
from flask import Flask
import dash
import dash_table
import dash_html_components as html
import dash_core_components as dcc
from templates import MY_TEMPLATE
server = Flask(__name__)
app = dash.Dash(__name__, server=server)
# Create app layout
app.layout = html.Div()
if __name__ == "__main__":
server.run()
Apache 2.4를 사용하고 있으며 가상 호스트 구성은 다음과 같습니다.
<VirtualHost *:5000>
ServerAdmin admin-name-here
ServerName localhost:5000
WSGIScriptAlias / "D:/Git/tools/scripts/simUserInterface/index/web.wsgi"
DocumentRoot "D:/Git/tools/scripts/simUserInterface"
<Directory "D:/Git/tools/scripts/simUserInterface/index">
Require all granted
</Directory>
ErrorLog "D:/Git/tools/scripts/simUserInterface/logs/error.log"
CustomLog "D:/Git/tools/scripts/simUserInterface/logs/access.log" common
</VirtualHost>
내 컴퓨터에서 로컬로 내장 된 Flask 개발 서버를 사용하여 앱을 실행하면 모든 것이 제대로 작동하고 레이아웃이 예상대로 렌더링됩니다 (물론 내 레이아웃이 실제로 비어 있지 않습니다. 주요 사항에 집중하기 위해 코드를 삭제했습니다). 그러나 브라우저 (127.0.0.1:5000)를 통해 스크립트를 실행하면 템플릿 import MY_TEMPLATE에서 멈춘 것처럼 보입니다 . 브라우저가 무언가를로드하는 것처럼 보이지만 레이아웃을 렌더링하지 않습니다.
특정 줄 하나를 주석 처리하면 ( from templates import MY_TEMPLATE ) 모든 것이 잘 작동합니다.
나는 완전히 아이디어가 없으며 도움을 주시면 감사하겠습니다.
quq의 답변 덕분에 이제 내 앱이 마침내 실행 중입니다. 문제 요약 :-플라스크 애플리케이션이 Apache 서버에서 실행될 때 pandas를 가져 오는 데 문제가 있습니다.
해결책:
Apache 설치의 루트 디렉토리에있는 httpd.conf 끝에 다음 줄을 추가해야했습니다 (Windows 용).
WSGIApplicationGroup %{GLOBAL}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다