Uploading data to website using python
1
0
Entering edit mode
14 months ago
JurB • 0

Hey everyone I've as school project which needs me to collect certain data from NCBI and UniProt. After that this data used to generate HTML pages which is uploaded to an existing worldpress website

Now I'm stuck with finding out what I would use to upload this data to the website. I was considering using flask but it seems it can be done a lot easier. Does anybody have any suggestions, Thanks in advance.

Python • 484 views
ADD COMMENT
2
Entering edit mode
14 months ago

Actually, not really a bioinformatics question.

If you want to upload data to a web application, the backend needs to have a compatible API implemented that supports this, e.g. REST PUT / POST or GraphQL. Then, the backend decides how to handle the incoming data and eventually stores it in a database.

But for your use case, you will have a much simpler solution, if you directly access the database that holds the contents of your Wordpress site from Python via an ORM - for example SQL Alchemy or Tortoise can be used.

Btw: Don't use Flask, unless you truly need a web application. The whole thing comes down to using an Async framework, that dispatches network requests to the NCBI and UniProt APIs and then writes the results asynchronously to the SQL database that backs your Wordpress site. This is a relatively simple thing to do in Celery or Dramatiq. You can then dispatch new tasks to the scheduler from the command line.

My combo would be Dramatiq and SQL Alchemy - that's all you need (and RabbitMQ if we are talking about a lot of requests)

ADD COMMENT
0
Entering edit mode

Thank you for you're answer.

I probably should have formulated the question better but the data from NCBI and UniProt is used to generate HTML pages and these pages are added to the website. Sorry for the trouble

ADD REPLY
0
Entering edit mode

In that case, you can use Dramatiq to schedule your requests and render static pages with a template system like Mako or Jinja directly from Python (the latter is also used in Flask). In your Wordpress site, you then just link to those static pre-rendered pages that you can host on any web server.

But if you anyway use Wordpress CMS to do server-side rendering of your pages, why not just add the relevant content to the database and generate the pages / components dynamically upon request?

ADD REPLY

Login before adding your answer.

Traffic: 1703 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6