Closed casoetan closed 5 years ago
Using the first option throws
Sorry, can you clarify what you mean here by the first option - looks from the trace like you're running a management command (runserver?). Is this in relation to another issue? I'm assuming this is independent of the other issues but will need a little more information to investigate this. Thanks.
I'm sorry for not clarifying. I meant 1. Manual handling of file storage
.
Basically any import of TemporaryUpload
throws that (without even using it). I haven't been able to dig further. Maybe this evening.
The option I meant...
import os
from django_drf_filepond.models import TemporaryUpload
# Get the temporary upload record
tu = TemporaryUpload.objects.get(upload_id='<22-char unique ID>')
# Move the file somewhere for permanent storage
# The file will be saved with its original name
os.rename(tu.get_file_path(), '/path/to/permanent/location/%s' % tu.upload_name)
# Delete the temporary upload record and the temporary directory
tu.delete()
Thanks for the clarification, if you have a chance to investigate this later and can provide further details, that would be great. I'll also aim to take a look into this.
Just to provide an update on this, I've tested using a simple standalone test case as follows:
mkdir test-app; cd test-app
virtualenv test-env; source test-env/bin/activate
pip install Django django-drf-filepond
django-admin startproject testproject .
Now edit settings and add 'django_drf_filepond'
_to INSTALLEDAPPS as described in section 1 of configuration
Now create the database and enter a Django shell:
python manage.py migrate
python manage.py shell
Within the shell, the following now works fine for me:
from django_drf_filepond.models import TemporaryUpload
I've tested using the following environment: Python: 3.6.6 and 3.7.2 Django: 2.1.7 django-drf-filepond: 0.0.5
The error you're getting looks to be the result of some sort of Django configuration issue. If you could try the above test case and see if this works that would be good to know. If you are able to produce a similar test case that reproduces the problem, that would also be very useful.
That works. Will investigate further what the issue may be. Thanks
Noticed the issue. The that requires this package housing this loads earlier than the app where this was defined.
Thanks
Using the first option throws
Full Trace