Wasting time on the Internet can be a problem even for professional developers. I'd advise getting a plugin for your browser that will let you block those sites, at least at certain times of the day. For example, I have Facebook and other social media sites blocked on my work computer (by my own choice) except for a little while in the morning and during lunch. (Note that I'm not recommend a complete ban on using the Internet - you'll have to look up documentation, StackOverflow posts, etc. while coding, and that's fine. Just block the unproductive time-sucking sites.) More generally, try to create a space where you'll be as free of distractions as possible, so that it's hard to find something to do other than coding.
The other thing is just to force yourself to get started. Once you get started, it's easier to keep going. Tell yourself that you'll just code for five minutes, then go through with that. After the five minutes, most likely you'll want to keep going.
Finally, try to set a specific block of time each day for coding - for example, 7pm to 9pm (or whatever you have time for / whatever works in your schedule). Don't allow yourself to do anything else during that time. If you don't feel like coding, the rule is you have to just sit in front of the computer with the IDE open and the cursor blinking at you. Pretty soon, the boredom will force you to start coding something.