def check_dir(): try: if not os.path.exists(settings.MEDIA_ROOT): try: os.mkdir(settings.MEDIA_ROOT) except OSError: logging.error(traceback.format_exc()) return if not os.path.exists(settings.MEDIA_ROOT+"/att"): try: os.mkdir(settings.MEDIA_ROOT+"/att") except OSError: logging.error(traceback.format_exc()) return if not os.path.exists(settings.MEDIA_ROOT+"/att/biophoto"): try: os.mkdir(settings.MEDIA_ROOT+"/att/biophoto") except OSError: logging.error(traceback.format_exc()) return if not os.path.exists(settings.ATT_ROOT): try: os.mkdir(settings.ATT_ROOT) except OSError: logging.error(traceback.format_exc()) return if not os.path.exists(settings.ATT_ROOT+"/USERPIC"): try: os.mkdir(settings.ATT_ROOT+"/USERPIC") except OSError: logging.error(traceback.format_exc()) return except Exception as err: logging.error('%s\n%s' % (traceback.format_exc(), str(err)))