From: Zachary Vance Date: Sat, 3 Aug 2024 23:54:33 +0000 (-0400) Subject: Getting ready for prod X-Git-Url: https://git.za3k.com/?a=commitdiff_plain;h=82ae6802c6d42d71f0eb3bbd57e445a944d66454;p=blog.git Getting ready for prod --- diff --git a/blog b/blog index 2223f31..d3ad3c6 100755 --- a/blog +++ b/blog @@ -309,7 +309,7 @@ class Image(Templatable): pass # TODO class Blog(PseudoMap): - def __init__(self, config="config.yaml"): + def __init__(self, config): self.tags = {} # Tag -> str self.categories = {} self.authors = {} @@ -375,9 +375,9 @@ class Blog(PseudoMap): @property def static(self): - for dirpath, dirnames, filenames in Path(self.static_dir).walk(): + for dirpath, dirnames, filenames in os.walk(str(self.static_dir)): for name in filenames: - path = dirpath / name + path = Path(dirpath) / name yield Static(path, self) @property @@ -440,9 +440,10 @@ if __name__ == "__main__": ) parser.add_argument("-l", "--local", action='store_true', help="use relative paths for links") parser.add_argument("-p", "--publish", action='store_true', help="publish to blog2.za3k.com") + parser.add_argument("-c", "--config", help="location of config file", default="config.yaml") args = parser.parse_args() - blog = Blog() + blog = Blog(config=args.config) blog.local = args.local if args.local: blog.web_root = "file://" + blog.destination diff --git a/config.prod.yaml b/config.prod.yaml new file mode 100644 index 0000000..e348ce6 --- /dev/null +++ b/config.prod.yaml @@ -0,0 +1,55 @@ +# These two properties are always first, and always absolute paths +source: "/var/www/blog-src" +destination: "/var/www/blog" + +web_root: "https://blog.za3k.com" +title: 'blog of zachary "za3k" vance' +# For search bar +domain: "blog.za3k.com" +posts_per_page: 10 + +post_dir: "posts" +comments_dir: "comments" +page_dir: "page" +image_dir: "images" +static_dir: "static" + +author_template: "templates/author.mustache.html" +category_template: "templates/category.mustache.html" +index_template: "templates/index.mustache.html" +feed_template: "templates/feed.mustache.html" +layout_template: "templates/layout.mustache.html" +pagination_template: "templates/pagination.mustache.html" +post_template: "templates/post.mustache.html" +tag_template: "templates/tag.mustache.html" +tagcloud_template: "templates/tagcloud.mustache.html" + +# Non-local mode, preferred link address +author_url: "{{web_root}}/author/{{slug}}/" +author_paginated_url: "{{web_root}}/author/{{slug}}/{{page_num}}/" +category_url: "{{web_root}}/category/{{slug}}/" +category_paginated_url: "{{web_root}}/category/{{slug}}/{{page_num}}/" +tag_url: "{{web_root}}/tag/{{slug}}/" +tag_paginated_url: "{{web_root}}/tag/{{slug}}/{{page_num}}/" +index_url: "{{web_root}}" +index_paginated_url: "{{web_root}}/page/{{page_num}}" +post_url: "{{web_root}}/{{id}}/" +feed_url: "{{web_root}}/feed/" + +author_destination: "{{destination}}/author/{{slug}}.html" +author_paginated_destination: "{{destination}}/author/{{slug}}.{{page_num}}.html" +category_destination: "{{destination}}/category/{{slug}}.html" +category_paginated_destination: "{{destination}}/category/{{slug}}.{{page_num}}.html" +index_destination: "{{destination}}/page/index.html" +index_paginated_destination: "{{destination}}/page/index.{{page_num}}.html" +feed_destination: "{{destination}}/page/feed.xml" +image_destination: "{{destination}}/images/{{image}}" +page_destination: "{{destination}}/{{page}}" +post_destination: "{{destination}}/posts/{{id}}.html" +static_destination: "{{destination}}/{{relative_path}}" +tag_destination: "{{destination}}/tag/{{slug}}.html" +tag_paginated_destination: "{{destination}}/tag/{{slug}}.{{page_num}}.html" + +category_destination: "{{destination}}/category/{{slug}}.html" +index_destination: "{{destination}}/page/index.html" +tag_destination: "{{destination}}/tag/{{slug}}.html" diff --git a/requirements.txt b/requirements.txt index c2c04aa..47ffce5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +bs4 chevron +markdown2 pyyaml -watchdog