A
A
Andrey2021-08-31 20:02:05
Python
Andrey, 2021-08-31 20:02:05

How to install mongobd on heroku?

Hello, there is a telegram bot in interaction with the Momo cloud base, I get the following error in the logs:
2021-08-31T16:36:08.353831+00:00 app[worker.1]: Traceback (most recent call last):
2021- 08-31T16:36:08.353851+00:00 app[worker.1]: File "mainbot.py", line 10, in
2021-08-31T16:36:08.353947+00:00 app[worker.1]: db_of_orders = DataBase(host_db)
2021-08-31T16:36:08.353956+00:00 app[worker.1]: File "/app/database.py", line 5, in __init__
2021-08-31T16:36:08.354022+ 00:00 app[worker.1]: self.client = MongoClient(host)
2021-08-31T16:36:08.354031+00:00 app[worker.1]: File "/app/.heroku/python/lib/ python3.8/site-packages/pymongo/mongo_client.py", line 670, in __init__
2021-08-31T16:36:08.354237+00:00 app[worker.1]: res = uri_parser.parse_uri(
2021-08-31T16:36:08.354245+00:00 app[worker.1]: File "/app /.heroku/python/lib/python3.8/site-packages/pymongo/uri_parser.py", line 449, in parse_uri
2021-08-31T16:36:08.354378+00:00 app[worker.1]: raise ConfigurationError (
2021-08-31T16:36:08.354405+00:00 app[worker.1]: pymongo.errors.ConfigurationError: The "dnspython" module must be installed to use mongodb+srv:// URIs. To fix this error install pymongo with the srv extra:
2021-08-31T16:36:08.354405+00:00 app[worker.1]: /app/.heroku/python/bin/python -m pip install "pymongo[srv]"

What can be done ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey, 2021-08-31
@Varikorek

" mongodb://admin:[email protected] "
and not
"mongodb+ srv://admin:[email protected]/myFirstDa... "

S
ScriptKiddo, 2021-08-31
@ScriptKiddo

Maybe install pymongo as suggested.

To fix this error install pymongo with the srv extra...
python -m pip install "pymongo[srv]"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question