Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flask/non-flask database sharing
#1
Firstly, I have very little experience with python, so any constructive feedback on what I have done/should do with regards to the following issue that I have currently have, would be much appreciated.

I started creating a flask app that utilized both flask_sqlalchemy and flask_marshmallow. I got the code working and uploaded it to my shared hosting provider. All the rest api's are working as expected.

I now need to implement logic for processing large amounts of data in the database. After researching on-line, my plan was to use celery, and call a rest api that would then offload the job to celery so as not to block the rest api and cause a timeout. However, celery requires a worker server, such as RabbitMQ, and after speaking to the hosting company, they say this is not allowed.

I thought of creating another (non-flask) app that I can invoke from a cron job to do the heavy processing for me, which is allowed. The problem is that I don't want to duplicate the sqlalchemy database code that I already have, so my thought is to remove the dependency on flask for the sqlalchemy and marshmallow code and to turn all the database logic into a library that can be shared across both projects. This way, I would only have to write the database logic once.

So...
1) Am I heading down the right track?
2) Is there a better way to do this?
3) Should I just duplicate the database logic, so I can utilize the flask_sqlalchemy/flask_marshmallow packages in the flask app?
Reply
#2
(Feb-03-2023, 11:46 AM)MorganSamage Wrote: However, celery requires a worker server, such as RabbitMQ, and after speaking to the hosting company, they say this is not allowed.
It could be Redis as well if available from hosting
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
(Feb-03-2023, 11:56 AM)buran Wrote:
(Feb-03-2023, 11:46 AM)MorganSamage Wrote: However, celery requires a worker server, such as RabbitMQ, and after speaking to the hosting company, they say this is not allowed.
It could be Redis as well if available from hosting

Hi, and thanks for the quick response.

I did think of Redis, but the hosting company were implying that this type of functionality is not allowed, and I did send them the info on RabbitMQ and Redis, but just to make sure, I will ask them the direct question, regarding Redis.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using Flask with thonny for my project website need help Confusednoob 3 1,704 Mar-16-2025, 05:42 PM
Last Post: snippsat
  Moving flask app to sub folder on live site. Help This is driving me crazy **huh** Rosssaab 1 908 Jan-10-2025, 02:11 PM
Last Post: menator01
Question running Flask with waitress having web traffic log... SpongeB0B 3 8,052 Dec-09-2024, 03:34 AM
Last Post: bazinga
  Unable to Generate Class Code in Flask App - Form Not Submitting Correctly misbahskuy 1 1,150 Dec-08-2024, 07:07 PM
Last Post: snippsat
  Flask web app MySQL runtime error TheTiger 8 5,910 Dec-04-2024, 03:18 AM
Last Post: TheTiger
  Docker Flask App on windows system Osaci 0 987 Oct-27-2024, 06:12 PM
Last Post: Osaci
  Web app with DB Crud can't pip install flask-mysqldb TheTiger 4 2,374 Oct-23-2024, 12:30 AM
Last Post: TheTiger
  How do I capture URL information with Flask? MacAarthur 0 985 Sep-16-2024, 06:37 AM
Last Post: MacAarthur
  Flask_table module compatibility issue: cannot import name 'Markup' from 'flask' venkateshbalagiri 3 2,915 Sep-13-2024, 06:14 AM
Last Post: buran
  Flask basic help needed aArtur 2 965 Sep-09-2024, 06:45 PM
Last Post: aArtur

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020