Writing tests is one great answer, but be aware that writing and maintaining good tests will also take large amounts of time — and it’s worth it! It will save you time in the long run, but it will be very hard to feel any savings early on.
This SO answer looks good for Python / Django: https://stackoverflow.com/questions/1118183/how-to-debug-in-...
Aside from tests, proficiency with a debugger goes a long way. Take some time to read the manuals and explore debugging techniques. Chrome’s frontend debugger & profiler is very good, and so are the Firefox & IE & Safari debuggers. Start by finding out what features are available in your python & browser debuggers.
Look into Selenium for end-to-end regression testing.
Also just think about what it means to be crazy productive and how to increase productivity. Testing and debugging are necessary parts of overall productivity, so avoid thinking of coding as productive and debugging as unproductive.
Python is lovely because it lets you do all kinds of things super fast for small projects. But the small project coding style can turn into a liability for large projects. For example, it’s great to pack multiple kinds of values into a tuple array, using sorting and zip and map on ad-hoc combinations, and not have to slow down to define a class. But once your project gets bigger, that style will slow you down as debugging gets harder. The trick is making all of your code easy to understand at a glance to someone who didn’t write the code, and that’s a lot harder than it sounds. You have to plan some things and really work to avoid the temptation to be tricky. At least I do, anyway, and almost every programmer I’ve ever met.