Execute a function from an uploaded file

108 views Asked by At

I have a site, where I want to run a code from an uploaded file from every 2 hours. So the user can upload many files and choose which one is the active. After the two hours, I check the database for 'active' files, and I want to import that file, and run a method from that file.

Here's the model, which stores the uploaded files:

class File(models.Model):
    name = models.CharField(max_length=32, blank=True)
    file = models.FileField(upload_to='myApp/files/uploaded_files')
    active = models.BooleanField()

How can I call a method from that file?

0

There are 0 answers