base url and requirements inside docker

This commit is contained in:
dechert 2021-06-17 19:16:29 +02:00
parent 416c58ceb0
commit 464e8f87ab
5 changed files with 13 additions and 7 deletions

View File

@ -2,5 +2,6 @@ auth:
username: admin
hashedPassword: pbkdf2:sha256:150000$gWnHgdeJ$778d54af56408b434fdd7151f4d8ea88e1ad7525d47326aa70671962e1f654a1
prod: False
basePath: './'
outputPath: './output'
uploadPath: './upload'

View File

@ -18,5 +18,6 @@ with open(path_to_config, "r") as ymlfile:
credentials = cfg["auth"]
prod_mode = cfg["prod"]
base_path = cfg["basePath"]
output_path = cfg["outputPath"]
upload_path = cfg["uploadPath"]

View File

@ -2,5 +2,6 @@ auth:
username: admin
hashedPassword: pbkdf2:sha256:150000$gWnHgdeJ$778d54af56408b434fdd7151f4d8ea88e1ad7525d47326aa70671962e1f654a1
prod: True
basePath: './csv-to-marp-converter'
outputPath: './csv-to-marp-converter/output'
uploadPath: './csv-to-marp-converter/upload'

View File

@ -11,6 +11,7 @@ NUMBER_OF_ANSWERS = 5
import config_parser
OUTPUT_FODLER = config_parser.output_path
BASE_FODLER = config_parser.base_path
class QuestionAndAnswers:
@ -48,8 +49,8 @@ def write_markdown_file(csv_path):
for line in data:
if line.startswith("Kategorie"):
name_of_category = line.split(",")[0]
print("name_of_category")
print(name_of_category)
# print("name_of_category")
# print(name_of_category)
current_category = name_of_category
# do nothing if row is empty
elif line.split(",")[0] is "":
@ -61,7 +62,9 @@ def write_markdown_file(csv_path):
# static_part = ""
# copy template
template_name = "quiz-slides-template.md"
shutil.copyfile(template_name, markdown_path)
template_path = os.path.join(BASE_FODLER, template_name)
shutil.copyfile(template_path, markdown_path)
# with open(markdown_path, 'w', encoding='UTF-8') as markdown_file:
# append questions and answers to copy of template
@ -69,7 +72,7 @@ def write_markdown_file(csv_path):
# write month headline
# markdown_file.writelines(static_part)
for q_and_a in list_of_q_and_as:
print(q_and_a)
# print(q_and_a)
write_q_and_a_to_markdown_file(markdown_file, q_and_a)
markdown_file.close()
@ -98,7 +101,7 @@ def write_q_and_a_to_markdown_file(markdown_file, q_and_a):
def handle_q_and_a_row(line, list_of_q_and_as, category):
column_data = line.split(',')
print(column_data)
# print(column_data) # causes UnicodeEncodeError: 'ascii' codec can't encode character '\xf6' in position 49: ordinal not in range(128) in linux
# check size of array
print(len(column_data))
if len(column_data) is NUMBER_OF_ANSWERS:
@ -107,7 +110,7 @@ def handle_q_and_a_row(line, list_of_q_and_as, category):
# answers = column_data[-3:]
q_and_a = QuestionAndAnswers(question, answers, category)
list_of_q_and_as.append(q_and_a)
print(q_and_a)
# print(q_and_a)
return list_of_q_and_as

View File

@ -19,4 +19,4 @@ Werkzeug==2.0.1
zipp==3.4.1
PyYAML==5.4.1
# pywin32==301 # needed for docker error messages
pywin32==227
# pywin32==227 # produces error during pip install while building docker image