]> git.za3k.com Git - blog.git/commitdiff
Getting ready for prod
authorZachary Vance <za3k@za3k.com>
Sat, 3 Aug 2024 23:54:33 +0000 (19:54 -0400)
committerZachary Vance <za3k@za3k.com>
Sat, 3 Aug 2024 23:56:50 +0000 (19:56 -0400)
blog
config.prod.yaml [new file with mode: 0644]
requirements.txt

diff --git a/blog b/blog
index 2223f3147feedf60fdc4caeea1295a36ffeafb98..d3ad3c644e848ab3c1aba0fbaef1a746a78872fd 100755 (executable)
--- 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 (file)
index 0000000..e348ce6
--- /dev/null
@@ -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"
index c2c04aae89b2b1327ba0f3c670d91e870d7ed7e2..47ffce590ababf77a769e1df5aa7fb84e900f9fc 100644 (file)
@@ -1,3 +1,4 @@
+bs4
 chevron
+markdown2
 pyyaml
-watchdog