mirror of
https://github.com/ilri/csv-metadata-quality-web.git
synced 2024-11-26 16:38:21 +01:00
Add configurable requests cache directory
As I expected, on Google App Engine we can't write the cache file to the current working directory. I modified csv-metadata-quality CLI to check for the REQUESTS_CACHE_DIR environment variable so we don't really have to do anything different other than setting the variable.
This commit is contained in:
parent
e7dd8d1421
commit
4e52d1bcc9
10
main.py
10
main.py
@ -68,12 +68,22 @@ def process():
|
|||||||
if "experimental" in request.form:
|
if "experimental" in request.form:
|
||||||
args.append("-e")
|
args.append("-e")
|
||||||
|
|
||||||
|
# Set cache dir to our upload path so we can tell csv-metadata-quality
|
||||||
|
# to store its requests-cache database there instead of in the current
|
||||||
|
# working directory (we can only write to /tmp on Google App Engine).
|
||||||
|
# Also, make sure to keep our PATH!
|
||||||
|
env = {
|
||||||
|
"REQUESTS_CACHE_DIR": app.config["UPLOAD_PATH"],
|
||||||
|
"PATH": os.environ["PATH"],
|
||||||
|
}
|
||||||
|
|
||||||
# run subprocess and capture output as UTF-8 so we get a string instead of
|
# run subprocess and capture output as UTF-8 so we get a string instead of
|
||||||
# bytes for ansi2html
|
# bytes for ansi2html
|
||||||
results = subprocess.run(
|
results = subprocess.run(
|
||||||
["csv-metadata-quality"] + args,
|
["csv-metadata-quality"] + args,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
encoding="UTF-8",
|
encoding="UTF-8",
|
||||||
|
env=env,
|
||||||
)
|
)
|
||||||
# convert the output to HTML using ansi2html
|
# convert the output to HTML using ansi2html
|
||||||
conv = Ansi2HTMLConverter()
|
conv = Ansi2HTMLConverter()
|
||||||
|
4
poetry.lock
generated
4
poetry.lock
generated
@ -107,8 +107,8 @@ xlrd = "^1.2.0"
|
|||||||
[package.source]
|
[package.source]
|
||||||
type = "git"
|
type = "git"
|
||||||
url = "https://github.com/ilri/csv-metadata-quality.git"
|
url = "https://github.com/ilri/csv-metadata-quality.git"
|
||||||
reference = "1008acf35e2753d9194755dd186c5428a0c520e6"
|
reference = "0e9176f0a6f694e85d38bf15c6b80708402bfa8b"
|
||||||
resolved_reference = "1008acf35e2753d9194755dd186c5428a0c520e6"
|
resolved_reference = "0e9176f0a6f694e85d38bf15c6b80708402bfa8b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "decorator"
|
name = "decorator"
|
||||||
|
@ -7,7 +7,7 @@ license = "AGPL-3.0-only"
|
|||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.7.1"
|
python = "^3.7.1"
|
||||||
csv-metadata-quality = {git = "https://github.com/ilri/csv-metadata-quality.git", rev = "1008acf35e2753d9194755dd186c5428a0c520e6"}
|
csv-metadata-quality = {git = "https://github.com/ilri/csv-metadata-quality.git", rev = "0e9176f0a6f694e85d38bf15c6b80708402bfa8b"}
|
||||||
Flask = "^1.1.2"
|
Flask = "^1.1.2"
|
||||||
ansi2html = "^1.6.0"
|
ansi2html = "^1.6.0"
|
||||||
gunicorn = "^20.0.4"
|
gunicorn = "^20.0.4"
|
||||||
|
Loading…
Reference in New Issue
Block a user