/ Published in: Python
                    
                                        
Sometimes (ex. django templates section at setting.py), a function expects an absolute path, but it's more practical when developing to refer it to the current file position in our code base. The rel function does exactly that.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
import os
def rel(*x):
return os.path.normcase(os.path.join(os.path.dirname(__file__), *x))
Comments
 Subscribe to comments
                    Subscribe to comments
                
                