A lightweight, secure, and maintainable framework for executing dynamic Python scripts as internal APIs. In many enterprise IT environments, teams frequently need lightweight APIs for internal systems, automation, scheduled tasks, diagnostic tools, or ad-hoc scripts. These APIs don’t always justify a full microservice architecture, but they must be: To meet these needs, I built a…
Category: Python
about python
打造企業內部 API 平台:使用 Python + Flask + Docker + Apache Reverse Proxy
(一個可執行 .py 腳本、可分區管理、可控權限、可日誌化的輕量級 API Framework) 在企業內部資訊環境中,我們常常需要快速提供一些 API 介面給內部系統、後台工具、腳本或排程器使用。例如: 市面上雖有許多 API Gateway、後端框架,但如果只是內部使用,其實不需要架構過於複雜。 本篇文章分享我如何利用: 打造出一套 輕量但強大、可長期維運的 Internal API Platform。 這套系統現在已可讓我直接用: 來呼叫不同 Python 腳本,非常彈性。 ✨ 一、平台目標:快速、安全、可維運 這個 Internal API Platform 要做到: ✔ 1. 可以像執行 script 一樣執行 Python 例如: 每支 .py 都是獨立的 handler,只要定義: 即可對外提供 API。 ✔ 2. 分區管理 根據 URL 不同目錄: URL Prefix 對應目錄 用途 /xxx.py /app/xxx.py 一般 Script…