By frankieguz
Hello, I followed through the Flask app on a DO Kubernetes cluster guide here ([https://www.digitalocean.com/community/meetup_kits/getting-started-with-containers-and-kubernetes-a-digitalocean-workshop-kit]) and am looking to integrate this into an existing Worpress site I have that I made through DO’s Ubuntu 1-click install feature on a 1GB droplet.
I am wondering if it is possible to have a page on my WP site hold a public file upload box (iframe/contact form plug-in/whatever works) that sends uploaded files to my Flask app on Kubernetes. From there processing is done and the Flask app returns another file/results that I want to display on the original web page.
Alternatively I’m thinking I may need to simply send the viewer over to the web page hosting the flask app if the above isn’t possible…
Please let me know where to find guidance on this. Thanks! :)
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!
Hi there,
This should be doable, here are a couple of options you can consider:
Option 1: Integrate Flask app with WordPress
File Upload: WordPress has various plugins that support file upload. You can use one of those plugins to create a form that allows users to upload files. When a file is uploaded, your WordPress backend should be set up to send the file to your Flask app.
Flask App Processing: Your Flask app on Kubernetes can expose an API endpoint that accepts file uploads. This endpoint should be set up to receive files from your WordPress site, process them, and then return a response.
Display Results: The response from your Flask app can be displayed on your WordPress site using AJAX or similar techniques.
You’ll need to do some coding to make this work, especially on the WordPress side. This approach does not require the user to leave your WordPress site.
Option 2: Direct Users to Flask App
Another simpler approach is to direct users to your Flask app when they want to upload a file. Your Flask app can provide a user interface for file upload and display the results once processing is done. You can then provide a way for users to return to your WordPress site.
This approach is easier to implement, as you only need to create a link on your WordPress site to your Flask app. However, the user experience might not be as smooth as in the first approach, as users will need to navigate away from your WordPress site.
For both options, ensure that your Flask app is properly secured, as it will be receiving and processing user-uploaded files. Also, you need to properly manage networking between your WordPress Droplet and your Kubernetes cluster.
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.