Down in the Dumps..

So I'm currently trying to get healthy and in the best shape of my life. I'm training for a half marathon which I am so excited to run but my eating habits keeps making my life worse and harder. I gained a lot of weight when I got a stress fracture in may and then couldn't exercise till mid august. I gained 18 lbs. Now im trying really hard to focus on my eating habits but its so hard. Like all I want to do is eat sweets even though I will exercise so hard. Any ideas on what to do? I seriously don't know what else.