Django FileField (or ImageField) open() method returns None for valid file?

because open method of models.FileField doesn’t return anything

you can just use:

task.seq_file.read()

and you don’t need calculate path of file for checking if file exist. you can use task.seq_file.path:

if not os.path.isfile(task.seq_file.path):
    ....

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)