disable pdf export via rest in prod mode

This commit is contained in:
dechert 2021-06-18 15:24:13 +02:00
parent 7a5698467f
commit 152efedf7a
2 changed files with 46 additions and 1 deletions

View File

@ -13,8 +13,13 @@ Strings surrounded with quotation marks
The [marp-cli](https://github.com/marp-team/marp-cli) can be used to convert the md to pdf:
- Stand alone linux package https://github.com/marp-team/marp-cli/releases
- run as server with PORT=5000 marp -s ./slides
- requires wget for download
- requires chrome to convert to pdf
- docker container https://hub.docker.com/r/marpteam/marp-cli/
`docker run --rm --init -v $PWD:/home/marp/app/ -e LANG=$LANG marpteam/marp-cli slide-deck.md --pdf`
- Run marp cli in its own docker container in server mode!!!
- output folder as volumne, so that marp container can assess it
powerpoint export is also possible with --pptx
@ -32,5 +37,42 @@ https://pythonise.com/series/learning-flask/flask-uploading-files
python docker wait for container
CLI binary:
convert file
./marp --pdf ./slides/slide-deck.md
./marp --pdf ./slides/slide-deck.md
/opt/marp --pdf /code/csv-to-marp-converter/
start server
./marp --pdf --server ./slides/
PORT=4100 /opt/marp-cli --server ./
use marp server:
- link or embed marp server path (http://localhost:8080/) from result html
- Dockerfile
- download latest marp binary
- start server (on correct port)
wget -O marp-cli.tar.gz https://github.com/marp-team/marp-cli/releases/download/v1.1.1/marp-cli-v1.1.1-linux.tar.gz
when running release version from
[ WARN ] The environment variable CHROME_PATH must be set to executable of a build of Chromium version 54.0 or later.
[ ERROR ] Failed converting Markdown. (You have to install Google Chrome, Chromium, or Microsoft Edge to convert slide deck with current options.)
when running cli with docker
docker run -v $PWD:/home/marp/app/ -e LANG=$LANG marpteam/marp-cli quiz-slides-template.md --pdf
[ ERROR ] Failed converting Markdown. (EACCES: permission denied, open
'/home/marp/app/quiz-slides-template.pdf')
chmod -R 0777 output/
docker run -v $PWD:/home/marp/app/ -e LANG=$LANG -e PORT=4100 -p 4100:4100 marpteam/marp-cli --server ./ -d
docker run -d -v /home/marcelo/git/docker-python-multi-service/csv-to-marp-converter/output:/home/marp/app/ -e LANG=$LANG -e PORT=4100 -p 4100:4100 marpteam/marp-cli --server ./

View File

@ -64,7 +64,10 @@ def upload_image():
csv_file.save(output_file_path)
# run converter
converter.convert(output_file_path, True)
if config_parser.prod_mode:
converter.convert(output_file_path, False)
else:
converter.convert(output_file_path, True)
return render_template("return_result.html")
# return redirect(request.url)