print and redirect after render

thumb
km0 2 years ago
parent 5c179497d5
commit 8b4d9a523a

@ -46,6 +46,7 @@ def get_md_contents(filename, directory='./contents'):
def render_home(): def render_home():
print('Rendering home...')
with open(app.root_path + 'render.html', 'w') as f: with open(app.root_path + 'render.html', 'w') as f:
# get the basic info of the website from the /contents/home.md file # get the basic info of the website from the /contents/home.md file
meta, content = get_md_contents("home.md") meta, content = get_md_contents("home.md")
@ -70,6 +71,7 @@ def render_home():
"projects": projects_list "projects": projects_list
} }
f.write(render_template("home.html", **home)) f.write(render_template("home.html", **home))
print('Rendered!')
# FLASK APP # FLASK APP
@ -146,8 +148,9 @@ def pull():
@app.route('/api/render/') @app.route('/api/render/')
def render(): def render():
print('Request for rendering')
render_home() render_home()
return 'rendered' return redirect(url_for('home_page'))
# RUN # RUN
app.run(port="3132") app.run(port="3132")

Loading…
Cancel
Save