I 've played well over 800hrs and i hardly ever go to war.
Two things which will definitely make life a whole lot easier, plus tips...
A. The InfoAddict mod, if you don't already use it, can tell you how your military stacks up against other civs at any given time. By checking this you can make sure you have an adequate military - if your military is better than the average most civs won't attack you without a reason.
B. Sentries. The key is where to put them and to make sure they are upgraded to show the enemy what kind of resistance they'd be up against. Citadels are also good i find (with a cannon in it lol). Always ranged units on coastline, and wherever possible you want them on a hill for a better view (Sentry promotion from Armory is also useful). Look at the map and see where you would attack from if you were that civ and be careful who you allow Open Borders. Be wary of any strategic locations as the enemy may want that city. Allocate your military accordingly.
Tips...
Instead of conquering the nearest CS why not focus on building up good GPT and then buy their affections and focus mostly on that CS so they are permanent ally - while you do this you arm them with units (preferably at the time their prereq techs become available, not before they become obsolete) and don't be stingy. Yes, every unit you give them is one you don't have yourself but the threat of a powerful CS ally has deterred many a civ from fighting me (and if you are lucky enough to see the CS declare permanent war, you could actually watch as the CS expands to several cities which belonged to the aggressive civ, which is very amusing!).
NO DEFENSIVE PACTS. Firstly, don't tell the interactive video game you don't want a war lol - thats what it'll give you. Crucially though, it just drags you into other people's business and if you are using InfoAddict mod (i highly recommend doing so) then you can actually see the relations between civs and attitudes they have which makes diplomacy a whole lot easier - defensive pacts drag you into other people's wars or feuds and isn't worth doing. You may have had a research agreement or something and then the whole world dynamic gets radically altered. That to me, sounds like someone asking for war not trying to avoid it lol.
Walls, castles, before its too late. The idea is to have these up before the enemy decides to attack, not before he attacks. Being non-militaristic in this is about deterring the enemy, not defeating them. That's the golden rule. Don't denounce somebody far more powerful than yourself if you have no friends - unless you know what you're doing (again i'd recommend infoaddict for better diplomacy).
If none of this is enough and you just want to not think about war at all throughout the game then you could get a cheat mod like In Game Editor (IGE) or 'Have Fun', which i've tried myself but gameplay gets tedious when you overuse it, so i wouldn't recommend that really.
(Things to consider- you can take barbarians out of the game at the options menu; you can fiddle with the win conditions and take out conquest [but much more fun if you don't and with the above tips and practice you can avoid war 99% of the time anyways]; you can select civs to play against - egypt, india etc...)