samedi 21 octobre 2017

Django how to access a uploaded file in views?

In my views.py file, there are some functions like follows:

def upload_file(request):
    """
    upload a file and store it into the database,
    and the file will be predicted in another view immediately.
    """

def predict(request):
    """
    make prediction of the file uploaded in the 'upload_file' function.
    """

How to access the file which uploaded in upload_file function in the predict function? Here is my thought: 1. read the last row in the database, but this sounds a little silly. 2. use a cache system and retrieve the file from cache?

Is there any useful solution for this problem? please give me any hints or other resources.

Thanks for anyone's help.

Aucun commentaire:

Enregistrer un commentaire