title: Python Bottle framework error 500: can't find template in Daemon mode
body: <p>I'm currently working on a simple webapp in Python using the <a href="http://bottlepy.org/docs/dev/index.html" rel="nofollow">bottle framework</a>. Here is my app structure:</p>
  
  <p><strong>Structure</strong></p>
  
  <pre><code>lib
      - bottle.py
      - bottledaemon.py
      - lockfile.py
      - __init__.py
  view
      - dashboard.tpl
  run.py
  </code></pre>
  
  <p><strong>And here is my run.py code:</strong></p>
  
  <pre><code>#!/usr/bin/env python
  from lib.bottle import route, template, run, debug, request, static_file
  from lib.bottledaemon import daemon_run
  
  debug(mode=True)
  
  @route('/')
  def show_index():
  
      return template('dashboard')
  
  # If the following line is enabled, the server will start in non-Daemon mode.
  #run(host='0.0.0.0', port=80, debug=True)
  
  # If the following lines are enabled, the server will start in Daemon mode.
  if __name__ == "__main__":
    daemon_run()
  </code></pre>
  
  <p>So I want the WSGI server to run in a daemon by passing it to the <a href="https://pypi.python.org/pypi/BottleDaemon/0.1.0" rel="nofollow">bottle daemon script</a>. </p>
  
  <p><strong>The problem</strong></p>
  
  <p>When run the code non-daemonized it works. It shows me the correct template and in the CLI I can see the HTTP requests.</p>
  
  <p>When I run the same code in daemonized mode however, it does start as a daemon so that works fine, but it can't find the template anymore. It shows me this error msg:</p>
  
  <blockquote>
    <p>Error: 500 Internal Server Error</p>
    
    <p>Sorry, the requested URL 'HERE IS MY WEBSITE URL' caused an error:</p>
    
    <p>Template 'template' not found.</p>
  </blockquote>
  
  <p>So it looks like the file path of the .tpl file can't be found anymore when I start the webserver in daemonized mode. I've tried a lot of things already but I can't figure it out and I would like to keep the path dynamic. Any suggestions guys?</p>
  
  <p>Thanks!</p>