I’m struggling migrating my web app from a Droplet to the app platform.
I have a buzzing Django app hosted on DO Droplet (Ubuntu 18 + Gunicorn + Nginx). My aim is to migrate the whole thing to the App platform.
I have most of the setup figured out - my static files remain part of the slug, and my media files are handled by django-storages/boto3 and uploaded to DO Space.
What I’m missing is storing files uploaded with Form.FileField, but not stored explicitly. The process I’m trying to accommodate is:
The code bit in question is:
>def upl_list(request): >form = listForm >if request.method == 'POST': >filled_form = form(request.POST, request.FILES) >if filled_form.is_valid(): >testedlist = filled_form.cleaned_data['NipAccList'] >VerifDate = filled_form.cleaned_data['VerifDate'] >df = pd.read_excel(testedlist, header=None, usecols=[0, 1], dtype=str)
Disclaimer: not sure how to bypass the markdown, but let’s assume indentation and syntax are correct.
The above code parses the uploaded Excel nicely on the droplet, but when the same sequence is executed on the App platform, I get the “file not found error”:
FileNotFoundError at /whitelist/list [Errno 2] No such file or directory: 'uploaded_file.xlsx' Request Method: POST Request URL: <my App platform endpoint< Django Version: 3.1.5 Exception Type: FileNotFoundError Exception Value: [Errno 2] No such file or directory: 'uploaded_file.xlsx'
The execution fails at
"df = pd.read_excel(...)". the
"testedlist" variable seems to be assigned correctly (did I mention the whole thing works on a Droplet?).
Where do I look? What do I configure? What am I missing?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $100 of credit to try our products over 60 days!