if instance.id: new_name = '{}.{}'.format(instance.pk, ext) print(f'name is {new_name}') return os.path.join('images', new_name)
This blogpost is all about finding your current working directory and changing according to your choice Check current working directory for python program Follow the code snippet below to find your current working directory. This is the path in which your python program is currently running. import os print ( os. getcwd ()) Change current working directory of your python program Follow the code snippet below to accomplish the task. import os os. chdir ( ' c://desired_folder ' ) This will change your current working directory path to your desired path