Dynamically loading python source code

后端 未结 2 902
忘掉有多难
忘掉有多难 2021-02-06 10:38

I\'m currently playing with Flask and I can\'t figure out how the debug mechanism is working. To be more precise when I save the python file with my application I don\'t need to

2条回答
  •  醉梦人生
    2021-02-06 11:21

    The built-in reload() function can do this for you. It's likely that this function is behind what Flask does to reload code (after noticing that it has changed on disk in some way).

    The question How do I unload (reload) a Python module? has more information on this.

提交回复
热议问题