OK, I see what you are saying. It should be possible to read it directly from disk, you maybe just need to use the file path which you could do like:
import os
from django.conf import settings
path = os.path.join(setttings.UPLOAD_ROOT, "test", "1206", "sample_2021-02-23_d961fc.txt")
f = open(path, "r")
However, you will have to update the file path every time you upload a new file. Instead you can do something like:
from qatrack.qa.models import Test
test = Test.objects.get(id=1206)
f = test.attachment_set.filter(name__startswith="sample_").latest("id").attachment
readanalyse = f.read(5)
which should be easier to maintain long term.
RT