33import  connexion 
44from  connexion .resolver  import  RestyResolver 
55
6+ from  pyms .exceptions  import  AttrDoesNotExistException 
67from  pyms .flask .services .driver  import  DriverService 
78from  pyms .utils  import  check_package_exists 
89
@@ -31,6 +32,14 @@ class Service(DriverService):
3132        "project_dir" : PROJECT_DIR 
3233    }
3334
35+     @staticmethod  
36+     def  _get_application_root (config ):
37+         try :
38+             application_root  =  config .APPLICATION_ROOT 
39+         except  AttrDoesNotExistException :
40+             application_root  =  "/" 
41+         return  application_root 
42+ 
3443    def  init_app (self , config , path ):
3544        """ 
3645        Initialize Connexion App. See more info in [Connexion Github](https://github.com/zalando/connexion) 
@@ -57,6 +66,7 @@ def init_app(self, config, path):
5766        """ 
5867        check_package_exists ("connexion" )
5968        specification_dir  =  self .path 
69+         application_root  =  self ._get_application_root (config )
6070        if  not  os .path .isabs (self .path ):
6171            specification_dir  =  os .path .join (path , self .path )
6272
@@ -67,11 +77,13 @@ def init_app(self, config, path):
6777        params  =  {
6878            "specification" : self .file ,
6979            "arguments" : {'title' : config .APP_NAME },
80+             "base_path" : application_root ,
7081            "options" : {"swagger_url" : self .url },
7182        }
83+ 
7284        # Fix Connexion issue https://github.com/zalando/connexion/issues/1135 
73-         if  config . APPLICATION_ROOT   and   config . APPLICATION_ROOT   ! =  "/" :
74-             params ["base_path" ] =  config . APPLICATION_ROOT 
85+         if  application_root   = =  "/" :
86+             params ["base_path" ] =  "" 
7587
7688        app .add_api (** params )
7789        # Invert the objects, instead connexion with a Flask object, a Flask object with 
0 commit comments