|
|
|
@ -46,28 +46,8 @@ def get_md_contents(filename, directory='./contents'):
|
|
|
|
|
return metadata, html_content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# FLASK APP
|
|
|
|
|
base_url = "~kamo"
|
|
|
|
|
projects = 'projects'
|
|
|
|
|
|
|
|
|
|
# create flask application
|
|
|
|
|
app = Flask(__name__,
|
|
|
|
|
static_url_path=f'/soupboat/{base_url}/static',
|
|
|
|
|
static_folder=f'/soupboat/{base_url}/static')
|
|
|
|
|
# Markdown(app, extensions=['extra'])
|
|
|
|
|
# app.jinja_env.extend(jinja2_highlight_cssclass = 'codehilite')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# add the base_url variable to all the flask templates
|
|
|
|
|
@app.context_processor
|
|
|
|
|
def set_base_url():
|
|
|
|
|
return dict(base_url=base_url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Homepage
|
|
|
|
|
@app.route(f"/{base_url}/")
|
|
|
|
|
def home_page():
|
|
|
|
|
|
|
|
|
|
def render_home():
|
|
|
|
|
with open('render.html', 'r+w') as f:
|
|
|
|
|
# get the basic info of the website from the /contents/home.md file
|
|
|
|
|
meta, content = get_md_contents("home.md")
|
|
|
|
|
projects_list = []
|
|
|
|
@ -90,7 +70,30 @@ def home_page():
|
|
|
|
|
"content": content,
|
|
|
|
|
"projects": projects_list
|
|
|
|
|
}
|
|
|
|
|
return render_template("home.html", **home)
|
|
|
|
|
f.write(render_template("home.html", **home))
|
|
|
|
|
|
|
|
|
|
# FLASK APP
|
|
|
|
|
base_url = "~kamo"
|
|
|
|
|
projects = 'projects'
|
|
|
|
|
|
|
|
|
|
# create flask application
|
|
|
|
|
app = Flask(__name__,
|
|
|
|
|
static_url_path=f'/soupboat/{base_url}/static',
|
|
|
|
|
static_folder=f'/soupboat/{base_url}/static')
|
|
|
|
|
# Markdown(app, extensions=['extra'])
|
|
|
|
|
# app.jinja_env.extend(jinja2_highlight_cssclass = 'codehilite')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# add the base_url variable to all the flask templates
|
|
|
|
|
@app.context_processor
|
|
|
|
|
def set_base_url():
|
|
|
|
|
return dict(base_url=base_url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Homepage
|
|
|
|
|
@app.route(f"/{base_url}/")
|
|
|
|
|
def home_page():
|
|
|
|
|
return send_from_directory(f'{app.root_path}/render.html')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# For generic pages we can include a common template and change only the contents
|
|
|
|
@ -123,7 +126,12 @@ def sendStaticFiles(project, filename):
|
|
|
|
|
def pull():
|
|
|
|
|
if request.method == 'POST':
|
|
|
|
|
subprocess.call(['sh', '/home/kamo/public_html/update.sh'])
|
|
|
|
|
print(request.form['payload'])
|
|
|
|
|
|
|
|
|
|
with open('log.txt', 'a') as f:
|
|
|
|
|
f.write(request.form['payload'])
|
|
|
|
|
|
|
|
|
|
render_home()
|
|
|
|
|
|
|
|
|
|
return 'Updated'
|
|
|
|
|
return 'GET method not supported'
|
|
|
|
|
|
|
|
|
|