pythonturbogearsturbogears2

TurboGears loads page twice


I have noticed strange thing. When I have in my RootController:

class RootController(BaseController):
    secc = SecureController()
    error = ErrorController()

    @expose('app.templates.index')
    def index(self, **kwargs):
        print 'Hello from index!'
        return dict(page = 'index')

And I restart TB app and refresh index page (using Google Chrome 28), I get in my terminal:

Starting server in PID 5407.
serving on http://127.0.0.1:8088
Hello from index!
Hello from index!

Template language is mako, TurboGears version 2.2.2 and db is using PostgreSQL. Am I missing something or this is normal? Why is this happening.

EDIT Using curl:

Starting server in PID 25138.
serving on http://127.0.0.1:8088
Hello from index!

Using Firefox 23:

Starting server in PID 25227.
serving on http://127.0.0.1:8088
Hello from index!
Hello from index!

Solution

  • Finally, the problem was in the templates. If there is non-valid javascript or can't be downloaded, the page gets loaded twice (second time without the broken javascript). Just remove the javascript from the template and it works fine.

    In my case, there was something wrong in the flexie.js