base url and requirements inside docker
This commit is contained in:
parent
416c58ceb0
commit
464e8f87ab
@ -2,5 +2,6 @@ auth:
|
|||||||
username: admin
|
username: admin
|
||||||
hashedPassword: pbkdf2:sha256:150000$gWnHgdeJ$778d54af56408b434fdd7151f4d8ea88e1ad7525d47326aa70671962e1f654a1
|
hashedPassword: pbkdf2:sha256:150000$gWnHgdeJ$778d54af56408b434fdd7151f4d8ea88e1ad7525d47326aa70671962e1f654a1
|
||||||
prod: False
|
prod: False
|
||||||
|
basePath: './'
|
||||||
outputPath: './output'
|
outputPath: './output'
|
||||||
uploadPath: './upload'
|
uploadPath: './upload'
|
||||||
|
@ -18,5 +18,6 @@ with open(path_to_config, "r") as ymlfile:
|
|||||||
|
|
||||||
credentials = cfg["auth"]
|
credentials = cfg["auth"]
|
||||||
prod_mode = cfg["prod"]
|
prod_mode = cfg["prod"]
|
||||||
|
base_path = cfg["basePath"]
|
||||||
output_path = cfg["outputPath"]
|
output_path = cfg["outputPath"]
|
||||||
upload_path = cfg["uploadPath"]
|
upload_path = cfg["uploadPath"]
|
||||||
|
@ -2,5 +2,6 @@ auth:
|
|||||||
username: admin
|
username: admin
|
||||||
hashedPassword: pbkdf2:sha256:150000$gWnHgdeJ$778d54af56408b434fdd7151f4d8ea88e1ad7525d47326aa70671962e1f654a1
|
hashedPassword: pbkdf2:sha256:150000$gWnHgdeJ$778d54af56408b434fdd7151f4d8ea88e1ad7525d47326aa70671962e1f654a1
|
||||||
prod: True
|
prod: True
|
||||||
|
basePath: './csv-to-marp-converter'
|
||||||
outputPath: './csv-to-marp-converter/output'
|
outputPath: './csv-to-marp-converter/output'
|
||||||
uploadPath: './csv-to-marp-converter/upload'
|
uploadPath: './csv-to-marp-converter/upload'
|
15
converter.py
15
converter.py
@ -11,6 +11,7 @@ NUMBER_OF_ANSWERS = 5
|
|||||||
|
|
||||||
import config_parser
|
import config_parser
|
||||||
OUTPUT_FODLER = config_parser.output_path
|
OUTPUT_FODLER = config_parser.output_path
|
||||||
|
BASE_FODLER = config_parser.base_path
|
||||||
|
|
||||||
|
|
||||||
class QuestionAndAnswers:
|
class QuestionAndAnswers:
|
||||||
@ -48,8 +49,8 @@ def write_markdown_file(csv_path):
|
|||||||
for line in data:
|
for line in data:
|
||||||
if line.startswith("Kategorie"):
|
if line.startswith("Kategorie"):
|
||||||
name_of_category = line.split(",")[0]
|
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
|
current_category = name_of_category
|
||||||
# do nothing if row is empty
|
# do nothing if row is empty
|
||||||
elif line.split(",")[0] is "":
|
elif line.split(",")[0] is "":
|
||||||
@ -61,7 +62,9 @@ def write_markdown_file(csv_path):
|
|||||||
# static_part = ""
|
# static_part = ""
|
||||||
# copy template
|
# copy template
|
||||||
template_name = "quiz-slides-template.md"
|
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:
|
# with open(markdown_path, 'w', encoding='UTF-8') as markdown_file:
|
||||||
# append questions and answers to copy of template
|
# append questions and answers to copy of template
|
||||||
@ -69,7 +72,7 @@ def write_markdown_file(csv_path):
|
|||||||
# write month headline
|
# write month headline
|
||||||
# markdown_file.writelines(static_part)
|
# markdown_file.writelines(static_part)
|
||||||
for q_and_a in list_of_q_and_as:
|
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)
|
write_q_and_a_to_markdown_file(markdown_file, q_and_a)
|
||||||
|
|
||||||
markdown_file.close()
|
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):
|
def handle_q_and_a_row(line, list_of_q_and_as, category):
|
||||||
column_data = line.split(',')
|
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
|
# check size of array
|
||||||
print(len(column_data))
|
print(len(column_data))
|
||||||
if len(column_data) is NUMBER_OF_ANSWERS:
|
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:]
|
# answers = column_data[-3:]
|
||||||
q_and_a = QuestionAndAnswers(question, answers, category)
|
q_and_a = QuestionAndAnswers(question, answers, category)
|
||||||
list_of_q_and_as.append(q_and_a)
|
list_of_q_and_as.append(q_and_a)
|
||||||
print(q_and_a)
|
# print(q_and_a)
|
||||||
return list_of_q_and_as
|
return list_of_q_and_as
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,4 +19,4 @@ Werkzeug==2.0.1
|
|||||||
zipp==3.4.1
|
zipp==3.4.1
|
||||||
PyYAML==5.4.1
|
PyYAML==5.4.1
|
||||||
# pywin32==301 # needed for docker error messages
|
# pywin32==301 # needed for docker error messages
|
||||||
pywin32==227
|
# pywin32==227 # produces error during pip install while building docker image
|
||||||
|
Loading…
x
Reference in New Issue
Block a user