0

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!
nu.frix
  • 193
  • 1
  • 6

2 Answers2

0

Does your browser maybe do strange things?

Does it also happen when you access the site using curl/wget?

moschlar
  • 1,286
  • 11
  • 18
  • I edited my original post and added some info you requested. Looks like curl does everything as expected, but Firefox and Google Chrome load the page twice. – nu.frix Aug 16 '13 at 09:02
  • Then it must be something your browser does when displaying the website... What's in your template? Maybe you accidentally try to load a css/file from a wrong address? Or you do have a link to / or /index which your browsers try to prefetch! – moschlar Aug 17 '13 at 08:30
0

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

nu.frix
  • 193
  • 1
  • 6