It may be a red herring, but when there's a problem which isn't immediately explicable then the only real way to progress to investigate different areas until you get a good clue as to the real culprit. At first sight it doesn't seem too plausible that changing the content type of the response should fix the problem at all, so presumably there's something subtle going on.
I'm not aware of the web app reloading code paying any attention to the response of your web app at all (although one of the PA devs may correct me if I'm wrong) so changing the content type shouldn't have any effect. I would imagine it just restarts the application wrapper, or perhaps just sends it a signal to reload the source code. Since changing the content type apparently does have an effect then it would be interesting to work out why.
At risk of stating the obvious, have you tried running pyflakes
over your code? I can imagine that when the wrapper (re)loads the code then it might hang if there's something odd about it. Do you have a lot of code which is run at start up as opposed to in response to a HTTP request?
EDIT
It appears the reload button does make a request of the web application, presumably to check that it's come up properly - you can see this if you view your access log as suggested by @a2j above (go to the Web tab on your Dashboard and look for the link that ends with access.log
). However, I've just written a very quick test page which returns content type application/xhtml+xml
and validates correctly as an XHTML 1.0 Transitional document and that reloaded without issue, so there must be something quirky about your case which is triggering the problem.
First, get it back into the state where reloading doesn't seem to work and then try a reload, then examine your access logs and look at the final entry - it should have a user agent starting python-requests/1.2.0 CPython/2.7.3 ...
. See if there's anything odd about that line - for example, does it have a 200 response? Or if the line is missing, that tells us something too. You can paste it here fairly safely if you wish, it shouldn't contain any sensitive information.
Second, consider what your application does at startup. I wonder if it's just taking awhile to get ready for requests, so the reload function is timing out waiting for a response. Quite why that behaviour would change with content type I don't know, but then again that may be a red herring as I said at the start of my post - it's hard to say at this stage.
Also, I dug up this post which contains this explanation of what the reload button does:
The reload button rewrites the configuration file for the uWSGI worker and recreates the socket files. This is mainly relevant if you have upgraded your account recently or you have added static file mappings.