Sign In

Forgot your password? Request password reset...

Don't have an account? Register here...

Code Chronicles

In the dim glow of my computer screen, after hours of wrestling with a particularly stubborn bug, it finally happened. The lines of code aligned, the program ran seamlessly, and I felt that rush of triumph. Join me as I revisit these eureka moments and unravel the mysteries behind the code.

I write about my experiences and journey as a software developer, about coding topics that I've struggled with in the hopes that you don't have to, and about things I've learned that I think are awesome. This space is a melting pot of tutorials, discussions on tools, and explorations of intriguing software development concepts. Enjoy!

November 16, 2023 / 5 min read / 3,217 views 1 likes 1 comments

Last Updated: May 12, 2024

browser-sync css fastapi flask gunicorn html javascript jinja2 python uvicorn

Hot reload darkmode safe

Getting instant feedback for code changes is essential when developing a web application. Typical workflows for Python web applications involve a hot-reload functionality for the development web server that will automatically restart the server when changes to python files are detected. However, the server will not automatically restart when changes to HTML, CSS, or JavaScript files are detected. When those files are updated, you must manually restart the server for the changes to occur. Moreover, this typical workflow will not automatically refresh your web browser when you update files, so you must manually refresh the web page to see the changes.

In this tutorial, I’ll show you how to automatically hot-reload your FastAPI and Flask projects that use template engines like Jinja with web servers like uvicorn or gunicorn. After reading, you will be able to automatically restart your server and refresh your browser when Python, HTML, CSS, and other files change—no manual intervention required.

Showing 1 to 1 of 1 results