
    vzh                         S SK Jr  S SKJr  S SKJr  S SKrS SKr\" 5       r	\	R                  \S/SS/S/S9  \" \5      R                  S-  rS	\4S
 jrS\4S jr\" \5        g)    )FastAPI)CORSMiddleware)PathN*T)allow_originsallow_credentialsallow_methodsallow_headersapipathc                    SR                  U R                  [        [        5      R                  5      R                  S5      R                  5      n[        R                  R                  U[        U 5      5      nU(       a`  UR                  (       aO  [        R                  R                  U5      nU[        R                  U'   UR                  R                  U5        U$ g )N. )joinrelative_tor   __file__parentwith_suffixparts	importlibutilspec_from_file_locationstrloadermodule_from_specsysmodulesexec_module)r   module_namespecmods       C:\DailyRate\Backend\main.pyimport_module_from_pathr#      s    ((4++DN,A,ABNNrRXXYK>>11+s4yIDnn--d3#&K $
    api_dirc                     U R                  S5       HK  n[        U5      nU(       d  M  [        US5      (       d  M*  [        US5      n[        R                  U5        MM     g )Nz*.pyrouter)rglobr#   hasattrgetattrappinclude_router)r%   py_filer!   r'   s       r"   include_all_routersr.       sJ    ==(%g.373))S(+Fv&	 )r$   )fastapir   fastapi.middleware.corsr   pathlibr   importlib.utilr   r   r+   add_middlewarer   r   API_DIRr#   r.    r$   r"   <module>r6      s}     2   
i   %%%   x.

%
'$ ' ' G r$   