Sadly, i am not able to find a solution with that post.
I tried to add maxPoolSize=1 at the end, but it does not help.
This code runs fine in a console on my own pc, but it neither the web app nor a console call of the file does work. Are there more options to be considered?
I might add the error here as well:
2018-02-06 21:10:36,907: Error running WSGI application
2018-02-06 21:10:36,917: pymongo.errors.ServerSelectionTimeoutError: connection closed
2018-02-06 21:10:36,917: File "/var/www/tschm_pythonanywhere_com_wsgi.py", line 16, in <module>
2018-02-06 21:10:36,917: from rest import APP as application
2018-02-06 21:10:36,918:
2018-02-06 21:10:36,918: File "/home/tschm/mysite/rest.py", line 18, in <module>
2018-02-06 21:10:36,918: MONGO = PyMongo(APP)
2018-02-06 21:10:36,918:
2018-02-06 21:10:36,919: File "/home/tschm/.virtualenvs/myvirtualenv/lib/python3.6/site-packages/flask_pymongo/__init__.py", line 97, in __init__
2018-02-06 21:10:36,919: self.init_app(app, config_prefix)
2018-02-06 21:10:36,919:
2018-02-06 21:10:36,919: File "/home/tschm/.virtualenvs/myvirtualenv/lib/python3.6/site-packages/flask_pymongo/__init__.py", line 283, in init_app
2018-02-06 21:10:36,919: mechanism=auth_mechanism)
2018-02-06 21:10:36,919:
2018-02-06 21:10:36,920: File "/home/tschm/.virtualenvs/myvirtualenv/lib/python3.6/site-packages/pymongo/database.py", line 1167, in authenticate
2018-02-06 21:10:36,920: connect=True)
2018-02-06 21:10:36,920:
2018-02-06 21:10:36,920: File "/home/tschm/.virtualenvs/myvirtualenv/lib/python3.6/site-packages/pymongo/mongo_client.py", line 583, in _cache_credentials
2018-02-06 21:10:36,920: writable_preferred_server_selector)
2018-02-06 21:10:36,921:
2018-02-06 21:10:36,921: File "/home/tschm/.virtualenvs/myvirtualenv/lib/python3.6/site-packages/pymongo/topology.py", line 224, in select_server
2018-02-06 21:10:36,921: address))
2018-02-06 21:10:36,921:
2018-02-06 21:10:36,921: File "/home/tschm/.virtualenvs/myvirtualenv/lib/python3.6/site-packages/pymongo/topology.py", line 183, in select_servers
2018-02-06 21:10:36,921: selector, server_timeout, address)
2018-02-06 21:10:36,922:
2018-02-06 21:10:36,922: File "/home/tschm/.virtualenvs/myvirtualenv/lib/python3.6/site-packages/pymongo/topology.py", line 199, in _select_servers_loop
2018-02-06 21:10:36,922: self._error_message(selector))