Bottle Python Error 404: Not found: '/'
Question: I am very new to using bottle but whenever I try to run my programs I always
get the error Error 404: Not Found '/'. The app in my example is not fully
functional yet but it should at least display something on the screen. Even
with fully functional programs this happens. There are similar problems asked
but none of the solutions in those have worked.

    
    
    import bottle
    
    from cork import Cork
    from cork.backends import SQLiteBackend
    sb = SQLiteBackend('sasdasd.db', initialize=True)
    
    aaa = Cork(backend=sb)
    app = bottle.Bottle()
    def post_get(name, default=''):
        return bottle.request.POST.get(name, default).strip()
    @bottle.route('/login')
    def login():
        return '''
             <form action="/login" method="post">
             Username: <input name="username" type="text" />
             Password: <input name="password" type="password" />
            <input value="Login" type="submit" />
        </form>
    '''
    @bottle.post('/login')
    def login():
        """Authenticate users"""
        username = post_get('username')
        password = post_get('password')
        aaa.login(username, password, success_redirect='/', fail_redirect='/login')
    
    bottle.run()
    


Answer: As @Wooble points out in his comment, you need to register the route "/" if
you expect your webapp to respond with anything other than a 404 for that
path. Here's some code to illustrate:

    
    
    @bottle.get('/')
    def home():
       return 'Hello!'
    

Now your webserver will respond with an HTTP 200 and a body of "Hello!" when
you request /.

