After testing our Flask api on our local system, I have been unable to run the same app after deploying on IIS server. Basically it gives me 500 error whenever I use pypandoc, but when I remove it app works. You can consider the following simple snippet with pypandoc :
from flask import Flask
app = Flask(__name__)
import os
import pypandoc
#path= pypandoc.get_pandoc_path()
os.environ.setdefault('PYPANDOC_PANDOC','C:\\Pandoc\\pandoc.exe')
@app.route("/")
def home():
note =*** any html string ***
rtf_string = pypandoc.convert_text(note, 'rtf', format='html')
return rtf_string
if __name__ == "__main__":
app.run()
Earlier I was getting the following error before setting 'PYPANDOC_PANDOC'
{"message": "Failed to Insert Data. No pandoc was found: either install pandoc and add it to your PATH or or call pypandoc.download_pandoc(...) or install pypandoc wheels with included pandoc.", "status": 0}
But I followed the following links and that error went away : Flask cannot find Pandoc on Linux Server (nginx+uwsgi)
Now I get the following error page : enter image description here