better reloader with django's

The most depression thing today, is I found a solution to a problem from my OWN BLOG FOUR years ago!'s dev server auto-reloading sucks hell.

The child process will have os.environ['BOTTLE_CHILD'] set to True and start as a normal non-reloading app server. As soon as any of the loaded modules changes, the child process is terminated and re-spawned by the main process. Changes in template files will not trigger a reload. Please use debug mode to deactivate template caching.

The fact is it will neither reload, nor the child process will terminate when you Ctrl+C the main process.

Let's use Django's reloader for bottlepy development!

  from bottle import run, Bottle

  app = Bottle()

  def dev_server():
      run(app, host='', port=8080, debug=True)

  if '__main__' == __name__:
      from django.utils import autoreload

Everything went better than expected.

btw my Tumblr Markdown editor can not accept capital E and R, using PinYin IME is OK. strange!