AppEngine: Intermittent DJANGO_SETTINGS_MODULE is undefined error on Django with Python 2.7 on Google App Engine
Ever since moving from webapp to Django on Python 2.7, I was plagued with the following error, albeit intermittently. Whenever, I would flush my memcache or start a new instance or run into an unhandled exception, my appengine based app wouldn't start. Logs gave me the following error, Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined. I searched far and wide for a solution, looked up topics on stackoverflow. The DJANGO_SETTINGS_MODULE is a common problem for django novices like yours truly and stackoverflow had umpteen questions and answers regarding the issue, but I couldn't find the right answer. Well, let me start off with a piece of my bad code. I looked up the official documentation for pointers when I started the migration from webapp templates to purer Django templates on my appengine project. The Django Documentation on Settings page mentions the following two options to configure django settings on a project(ap...