Nginx блокирует работу базы данных Mongodb колбу - PullRequest
0 голосов
/ 12 октября 2019

У меня есть скрипт колбы для работы с Mongodb через pymongo. Он работает нормально на порте open 5000, но когда я хочу перейти на него через nginx, я получаю ошибку

. Для этого проекта я использую nginx> uwsgi sock> wsgi.py> app.py uwsgi> wsgi. py> app.py работа без nginx на открытом порту 5000

server {
    listen 80;
    server_name my_ip;

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/home/viktor/my_project/project.sock;
    }
}

Oct 11 12:05:08 funloot3 uwsgi[11123]: Traceback (most recent call last):
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "/home/funloot/funloot/flaskenv/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
Oct 11 12:05:08 funloot3 uwsgi[11123]:     response = self.full_dispatch_request()
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "/home/funloot/funloot/flaskenv/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request
Oct 11 12:05:08 funloot3 uwsgi[11123]:     rv = self.handle_user_exception(e)
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "/home/funloot/funloot/flaskenv/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception
Oct 11 12:05:08 funloot3 uwsgi[11123]:     reraise(exc_type, exc_value, tb)
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "/home/funloot/funloot/flaskenv/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
Oct 11 12:05:08 funloot3 uwsgi[11123]:     raise value
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "/home/funloot/funloot/flaskenv/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request
Oct 11 12:05:08 funloot3 uwsgi[11123]:     rv = self.dispatch_request()
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "/home/funloot/funloot/flaskenv/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request
Oct 11 12:05:08 funloot3 uwsgi[11123]:     return self.view_functions[rule.endpoint](**req.view_args)
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "./app.py", line 230, in my_stat
Oct 11 12:05:08 funloot3 uwsgi[11123]:     result = push_step(uid, request.args.get('steps'), request.args.get('timestamp'), request.args.get('check'))
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "./app.py", line 169, in push_step
Oct 11 12:05:08 funloot3 uwsgi[11123]:     step_user = steps_db.find_one({'uid': uid})
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "/home/funloot/funloot/flaskenv/lib/python3.6/site-packages/pymongo/collection.py", line 1273, in find_one
Oct 11 12:05:08 funloot3 uwsgi[11123]:     for result in cursor.limit(-1):
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "/home/funloot/funloot/flaskenv/lib/python3.6/site-packages/pymongo/cursor.py", line 1156, in next
Oct 11 12:05:08 funloot3 uwsgi[11123]:     if len(self.__data) or self._refresh():
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "/home/funloot/funloot/flaskenv/lib/python3.6/site-packages/pymongo/cursor.py", line 1050, in _refresh
Oct 11 12:05:08 funloot3 uwsgi[11123]:     self.__session = self.__collection.database.client._ensure_session()
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "/home/funloot/funloot/flaskenv/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1807, in _ensure_session
Oct 11 12:05:08 funloot3 uwsgi[11123]:     return self.__start_session(True, causal_consistency=False)
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "/home/funloot/funloot/flaskenv/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1760, in __start_session
Oct 11 12:05:08 funloot3 uwsgi[11123]:     server_session = self._get_server_session()
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "/home/funloot/funloot/flaskenv/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1793, in _get_server_session
Oct 11 12:05:08 funloot3 uwsgi[11123]:     return self._topology.get_server_session()
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "/home/funloot/funloot/flaskenv/lib/python3.6/site-packages/pymongo/topology.py", line 482, in get_server_session
Oct 11 12:05:08 funloot3 uwsgi[11123]:     None)
Oct 11 12:05:08 funloot3 uwsgi[11123]:   File "/home/funloot/funloot/flaskenv/lib/python3.6/site-packages/pymongo/topology.py", line 205, in _select_servers_loop
Oct 11 12:05:08 funloot3 uwsgi[11123]:     self._error_message(selector))
Oct 11 12:05:08 funloot3 uwsgi[11123]: pymongo.errors.ServerSelectionTimeoutError: No replica set members found yet

Traceback на скриншоте

Посмотреть сообщение на imgur.com

...