A mirror of my website's source code.

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

Delete dev server

steve0greatness,
created on Monday, 22 January 2024, 00:16:07 (1705882567), received on Monday, 6 May 2024, 02:55:35 (1714964135)
Author identity: Steve0Greatness <75220768+Steve0Greatness@users.noreply.github.com>

997e63425348035df60fdd354388ec722674a215

dev-server.py

@@ -1,32 +0,0 @@

                                
                                
                                
                            
                                
                                    
                                        
                                        from build import main as BuildStaticSite, PostList
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        from flask import Flask, redirect
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        app = Flask(__name__)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        @app.route("/")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        def Index():
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            return """<a href="/build">Rebuild site</a>"""
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        @app.route("/blog-list")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        def Writer():
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            BlogListHTML = "<br/>".join(("<a href=\"/edit/%s\">%s</a>" % (post["origin"], post["title"]) for post in PostList))
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            return """<a href="/new-post">+</a><hr/>%(listing)s""" % { "listing": BlogListHTML }
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        @app.route("/edit/<post>")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        def Editor(post: str):
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            BlogListDict = { PostObj["origin"]: PostObj for PostObj in PostList }
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            if post not in BlogListDict:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                return redirect("/")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            return """"""
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        @app.route("/new-post")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        def NewPost():
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            return """"""
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        @app.route("/build")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        def Builder():
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            BuildStaticSite()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            return redirect("/")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        if __name__ == "__main__":
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            app.run("0.0.0.0", 9000, debug=True)