This depends a lot on the city; different cities allow you to lock up to different things, and have different crime rates.
For example, I've been to major European cities where a lot of the bikes were happily locked where they would have been stolen in minutes in New York City.
I'd first start by removing things that could be easily stolen (lights, seatpost, etc.) or fastening them permanently / locked to the bike (e.g. using pitlocks on the seatpost). You can also glue in ball bearings into hex heads. Pitlocks can also be used on the wheels as an aide to locking them properly.
Then, use a good U-lock properly (leave minimum amount of space for someone to jam a jack in, difficult to cut) and a good quality chain if you're at home (so you have 2 tools). Make sure to grab the wheels (rim is sufficient) and the frame.
Also, make sure to lock to something that is safe to lock to (people have cut down small trees to steal bikes, or lifted something chained to a post over a post; or some things aren't as safe as they seem to some people, e.g. street signs which are often easily removable). The light post may not be a good idea; depending on the city, the police may cut the locks and impound the bike.
In spite of all this, there is a decent chance that a bike will get stolen in a tougher city; having a cheaper bike outside as a beater and taking out a nicer bike periodically (stored in your apartment) can help.
Alternatively, you can carry your bike into your apartment. It's inconvenient but its probably the safest option you have. Note that none of the above options prevent vandalism of the bike (as pointed out by Michael in the comments), which may or may not be of concern in your city.