MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / main

Function main

codewiki/src/fe/web_app.py:75–129  ·  view source on GitHub ↗

Main function to run the web application.

()

Source from the content-addressed store, hash-verified

73
74
75def main():
76 """Main function to run the web application."""
77 import uvicorn
78
79 parser = argparse.ArgumentParser(
80 description="CodeWiki Web Application - Generate documentation for GitHub repositories"
81 )
82 parser.add_argument(
83 "--host",
84 type=str,
85 default=WebAppConfig.DEFAULT_HOST,
86 help=f"Host to bind the server to (default: {WebAppConfig.DEFAULT_HOST})"
87 )
88 parser.add_argument(
89 "--port",
90 type=int,
91 default=WebAppConfig.DEFAULT_PORT,
92 help=f"Port to run the server on (default: {WebAppConfig.DEFAULT_PORT})"
93 )
94 parser.add_argument(
95 "--debug",
96 action="store_true",
97 help="Run the server in debug mode"
98 )
99 parser.add_argument(
100 "--reload",
101 action="store_true",
102 help="Enable auto-reload for development"
103 )
104
105 args = parser.parse_args()
106
107 # Ensure required directories exist
108 WebAppConfig.ensure_directories()
109
110 # Start background worker
111 background_worker.start()
112
113 print(f"🚀 CodeWiki Web Application starting...")
114 print(f"🌐 Server running at: http://{args.host}:{args.port}")
115 print(f"📁 Cache directory: {WebAppConfig.get_absolute_path(WebAppConfig.CACHE_DIR)}")
116 print(f"🗂️ Temp directory: {WebAppConfig.get_absolute_path(WebAppConfig.TEMP_DIR)}")
117 print("\nPress Ctrl+C to stop the server")
118
119 try:
120 uvicorn.run(
121 "fe.web_app:app",
122 host=args.host,
123 port=args.port,
124 reload=args.reload,
125 log_level="debug" if args.debug else "info"
126 )
127 except KeyboardInterrupt:
128 print("\n👋 Server stopped")
129 background_worker.stop()
130
131
132if __name__ == "__main__":

Callers 2

run_web_app.pyFile · 0.90
web_app.pyFile · 0.70

Calls 5

ensure_directoriesMethod · 0.80
get_absolute_pathMethod · 0.80
runMethod · 0.80
stopMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected