Hacker News new | ask | show | jobs
by WorldMaker 3129 days ago
Why not both? Most frameworks (including Flask) already have static file/page tools/middleware. Just set up the static file hosting part of your framework. At that point it is "merely" a CI/CD issue to compile your static site and deliver it to the static directory your framework expects.

Python frameworks, owing to the Django CDN-focused approach, tend to make static assets harder than they have to be, so the answer to a better approach for Python in specific is often to setup the static asset hosting more directly in your web server than in your framework. But that too is "just" a configuration/CI/CD issue.

Finally, an approach that is increasingly common is simply to treat your own dynamic server-side assets like a "3rd-party" API: host it on something like api.example.com and let your main website just be the static app served from a static file server/CDN.