In software development it's very easy to look at some older work and write it off as garbage, slander the developers, and somehow feel as if you're above making such poor choices in the code you write.
Except you have to make choices when writing code all the time based on the constraints you're facing, the time pressures, what you know at the time vs what becomes clear later on. No one is out here trying to write bad code, but it can sometimes end up looking that way.
I have worked at enough places now to expect an entire day to go just on getting things to run locally. This is how it is, especially with the absurd house-of-cards that is web development.