The most difficult decisions you are going to make in Clash of Clans is when to upgrade your town hall. I can't tell you the perfect time, because there is none! It is completely opinionated but in this article i will hopefully give you a better idea of when you should upgrade your town hall.
Here's a list of defenses and what i believe they should be upgraded to:
Cannons and Archer Towers- These should be maxed out even if they cost 3 million (cannon level 11 or archer tower level 10) because they are the main single target defenses. These sorts of defenses are very helpful because they destroy giants very quickly.
Mortars and Wizard Towers- These should be maxed out as well. These defenses can dominate minor troops, especially mortars. And given time they will destroy a pack of giants. Mortars and wizard towers are relatively cheap for the impact they can have on a defense.
Air defenses- These are important but they don't need to be maxed. 1 or 2 levels below max upgrade is still ok. This is because they aren't as vital as other defenses but they also take really long. It once took my brother 4 times to upgrade his air defense because he kept cancelling it for more important upgrades (barb king to level 5).At level 7 town hall it is fine to have level 4 air defenses, don't stress over max upgrading everything.
Hidden Teslas- These are another single target defense and their ability to appear out of nowhere is so useful, but yet again 1 or 2 levels below is respectable. The cost is hard and time again is an issue. If your teslas are having an effect on most battles like mine, upgrade them. Otherwise you don't have to bother.
Walls- These are very important! They repel the enemy. But they cost bucket loads! Unless you're a hardcore player i think that 1 level below is acceptable. 200k for level 7 walls or even 500k for level 8 walls is hugely expensive! I personally believe that your walls should be 2 levels above the wall breaker level that attack you. This way the 1 wall breaker can't destroy the wall by itself, they need more wall breakers or giants.
But just because you've maxed out your defenses doesn't mean you should be upgrading your town hall! You need to be able to attack as well. Troops in the lab should be maxed, clan castle should be maxed and army camps should be maxed because these improve your attacking potential.
Some things that don't need to be maxed though are spells in the lab, barracks and collectors and mines. These should all be high level but it is not crucial that they need to be upgraded. These sorts of things are perfect to be upgrading whilst your town hall upgrades because they are cheap (remember you need lots of money for when your town hall finishes upgrading for new defenses etc. Wizard Tower, Xbow, Inferno Tower). These upgrades also take quite a short time.
Also remember when you upgrade your town hall you will get new defenses and even possibly an extra army camp, barrack, storages etc. 'Is it worth upgrading your town hall for new items against a bigger loot penalty?' is the sort of question you should be asking yourself. Will your village advance? You should base your answers to these questions on how your village defends and how you attack.
All in all, If you think you are good enough to upgrade your town hall based on this article, you definitely should. It's your Clash, your decision, just enjoy the game!
*This is my first go at an article, hope you like!