Fix some directory issues
This commit is contained in:
parent
82611c358f
commit
f170d2ca90
10
builder.py
10
builder.py
|
|
@ -5,6 +5,7 @@ import re
|
||||||
from pytz import timezone
|
from pytz import timezone
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import bisect
|
import bisect
|
||||||
|
import shutil
|
||||||
from jinja2 import Environment, PackageLoader, select_autoescape
|
from jinja2 import Environment, PackageLoader, select_autoescape
|
||||||
|
|
||||||
scraper_path = 'scraper/'
|
scraper_path = 'scraper/'
|
||||||
|
|
@ -60,13 +61,16 @@ for folder in os.listdir(scraper_path):
|
||||||
post['caption'] = file.read()
|
post['caption'] = file.read()
|
||||||
|
|
||||||
if ('timestamp' in post.keys()):
|
if ('timestamp' in post.keys()):
|
||||||
with open(output_path + 'posts/' + str(post['timestamp']) +'.html', 'w+') as output_file:
|
with open('posts/' + str(post['timestamp']) +'.html', 'w+') as output_file:
|
||||||
output_file.write(post_template.render(post=post))
|
output_file.write(post_template.render(post=post))
|
||||||
|
|
||||||
homepage_template = env.get_template("index.html")
|
homepage_template = env.get_template("index.html")
|
||||||
|
|
||||||
with open(output_path + 'index.html', "w+") as output_file:
|
with open(output_path + '/index.html', "w+") as output_file:
|
||||||
output_file.write(homepage_template.render())
|
output_file.write(homepage_template.render())
|
||||||
|
|
||||||
with open(output_path + 'blog.html', "w+") as output_file:
|
with open(output_path + '/blog.html', "w+") as output_file:
|
||||||
output_file.write(blog_template.render(posts=posts))
|
output_file.write(blog_template.render(posts=posts))
|
||||||
|
|
||||||
|
# copy all assets to be in the output
|
||||||
|
shutil.copytree('assets/', 'static/', dirs_exist_ok=True)
|
||||||
Loading…
Reference in a new issue