Luca Luca - 25 days ago 4x
Python Question

import python packages from another directory into a Django project

I have a Django project where a user uploads some images and I have some image processing routines which I write and they reside in a completely different folder in my hard drive (on the same machine).

Now, I plan to use something like celery to process these images. So, the idea would be that as soon as the files get uploaded, I can start some celery task which would process these images.

Now, I was wondering how I can change my Django settings so that these image processing routines are available from within my Django project? So, my image processing project has the following structure:

--- calibration
--- io
--- report
--- utils

So from my django project, I hope to be able to do something like:

from io import *

and be able to use the classes defined there.


You must append the folder to your python path using sys.path.append() then import using the module name as normal