Hi,
I am working with one script and one Flask API with a wgsi server that are running in a VM with ubumtu 22.04 as an OS.
The script goes to get data from a weather prediction service and push it in MongoDB instance using the MongoClient fron pymongo. It was the 1st thing that I implemented and it works fine.
The Flask API receives post requests from outside the server that inlude the name of the DB, the name of the collection as well as the query the MongosDB instance populated by the script but every time I run it the MongoClient from the pymongo library does not load (see screenshot below)
Both are following the same way to connect to the database (see below) but the Flask API does not load the module of the package.
Connection to the DB:
client = pymongo.MongoClient("mongodb://localhost:27017/")
db = client[data['db']]
col = db[data['collection']]
I have tried to use flask-pymongo but I got the kind of error message ( AttributeError: module ‘flask_pymongo’ has no attribute ‘PyMongo’)
The flask app has its own virtual environment but both system are runnung the latest versions of the packages.
Does anyone has an idea of what I am doing wrong? It should work with this set up as far as I know.