refactored django-open-app and added comments

refactored django-open-app to be clearer rather than concise (replaced in-line functions with variables) and added comments