Commits

Alexander Shorin committed 9480f55

Fix app loading from specified path

  • Participants
  • Parent commits e8048ac

Comments (0)

Files changed (1)

File xmppflask/run.py

 
 def main():
     def load_app_from_configstr(app_str):
+        # TODO: There should be better way to load app
         path, app_varname = app_str.rsplit(u':', 1)
         path = os.path.abspath(path)
         if not os.path.exists(path):
             return
         dir_ = os.path.dirname(path)
         filename = os.path.basename(path)
-        sys.path[0:0] = [dir_]
-        module = __import__(filename.rstrip('.py'))
+        sys.path.insert(0, dir_)
+        module = __import__(filename.rsplit('.py')[0])
+        sys.path.pop(0)
         app = getattr(module, app_varname)
         return app