From 52135ec50911130bddec5a139f8bcf3bdbaf488b Mon Sep 17 00:00:00 2001 From: David Itehua Xalamihua Date: Tue, 20 Aug 2024 17:01:57 -0600 Subject: [PATCH] =?UTF-8?q?trabajando=20en=20la=20secci=C3=B3n=20de=20repo?= =?UTF-8?q?rtes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __pycache__/db_conf.cpython-312.pyc | Bin 0 -> 2019 bytes db_conf.py | 23 +++--------------- help_files/upgrade_coordenadas.py | 4 +-- help_files/upgrade_directorio_centros_sict.py | 3 +-- help_files/upgrade_sitios_ai.py | 3 +-- 5 files changed, 7 insertions(+), 26 deletions(-) create mode 100644 __pycache__/db_conf.cpython-312.pyc diff --git a/__pycache__/db_conf.cpython-312.pyc b/__pycache__/db_conf.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7d38f6919c0a37fe58d49217cc2f27857d4ebd0 GIT binary patch literal 2019 zcmcIk&2Jk;6rcUf+FskZsbe5XV@itTDvF^Z5-o^BNkRP}NCYl>S#5VFshy42omq!C zN+ln1u%${##KBiiNL6~^pWwuWD3!XJ^iYWtx2i@U^~9U?M;tY2xG>Vbd2iq6y!V^= zEt!lXSh@VKOMj~f{UL<@(t1qiXJFb0BP@By>h6*yMY3$k(XLpEjEGV;`p!o?miMHt zWNBa{m(3$xpF7o8>HGF~qP+u7)`*P0LRj5GSlg3((T%!P(Ek*|0*{rdHYRH&m+&|) zvA|}8t}(Z3*`>XrP-hzCHX=wI$&!g;saUc!EL%EOwjh;AV;Oa=p!3wc6FAo$MiwC) zp`}l<2yvt8vtXGL=JqOy;*S7T;Ol${iP|XWr$gmotH>0g0D9kDWxdZG?L*p=`YR3T zqiG&_3J%MUmA&39AIO_>IeASNMqQS1QB}sOU5|@!bd;gxaMl6|JG-{9Jcyl=+m8 zkagnL0>X_Y61b4u{A!Vv+`x8$7NHafvNT(*b7PqVwm8m4?l|OT`-&6Aw>CTk)p)B8AS4wa0hIf1GUU&yCb}s+HQQ zJuxQ3Os+k(J9Ut`*wjP#Z??>bsn9UDZwbK{HeF6Y1e_M5Ns$85=Z$@M=i#Hgr)o)bhMmx@c)1*`xag_j7? zF+p-b3MzeD@b3x|>BoU%;+YYEq!YmKw7}9(u8j*PU~Nc$L4+s+IRkQ+!pwM>eG}Mz z&s}|DT>B4bqax=*A;t~ct~jg2wt3vPSAAUb1aI2*{hH(TG_k>59%_!5E}azQJs^)z z6frt~w~eBgG5DBh&=v|uCmMIcM7l8_CbEtBmugBI>*RrS{e(4Cqch)KAwe_}u9lf! z;j+)T4h{d#zr^;ig2zO9UiJ_Al{2lRW?c literal 0 HcmV?d00001 diff --git a/db_conf.py b/db_conf.py index 96ae8f6..8c899e5 100644 --- a/db_conf.py +++ b/db_conf.py @@ -3,28 +3,11 @@ import psycopg2 import json import os -def ip_db_backend_server(): - # nombre_equipo = socket.gethostname() - # direccion_ip = socket.gethostbyname(nombre_equipo) - ip_device = os.getenv("ip_device") - # print("la ip es: ", ip_device) - # print(f'La ip del equipo es : {direccion_ip}') - # ip web server : ip db server - try: - db_backend = { - "192.168.1.75": "192.168.1.79", - "192.168.1.76": "192.168.1.80", - "192.168.1.77": "192.168.1.79", - "192.168.1.78": "192.168.1.80", - "192.168.1.83": "192.168.1.79", - } - return db_backend[f'{ip_device}'] - except Exception: - return "192.168.1.80" - +ip_device = os.getenv("ip_device") +db_server = json.loads(os.getenv("dist_servs"))[ip_device] class DataBaseServer(): - db_server_ip = ip_db_backend_server() + db_server_ip = db_server port = 5432 user = "postgres" diff --git a/help_files/upgrade_coordenadas.py b/help_files/upgrade_coordenadas.py index 316f8b4..7090d75 100644 --- a/help_files/upgrade_coordenadas.py +++ b/help_files/upgrade_coordenadas.py @@ -3,8 +3,8 @@ import json import os ip_device = os.getenv("ip_device") -db_server = json.loads(os.getenv("dist_servs")) -db_server = db_server[ip_device] +db_server = json.loads(os.getenv("dist_servs"))[ip_device] + f_path = os.path.join(os.getcwd(), "json_files/coordenas_unicas.json") # cargar coordenadas a la memoria de la computadora diff --git a/help_files/upgrade_directorio_centros_sict.py b/help_files/upgrade_directorio_centros_sict.py index d1ca722..501e518 100644 --- a/help_files/upgrade_directorio_centros_sict.py +++ b/help_files/upgrade_directorio_centros_sict.py @@ -3,8 +3,7 @@ import json import os ip_device = os.getenv("ip_device") -db_server = json.loads(os.getenv("dist_servs")) -db_server = db_server[ip_device] +db_server = json.loads(os.getenv("dist_servs"))[ip_device] # Parámetros de conexión a la base de datos file_path = os.path.join(os.getcwd(), "json_files/DirectorioCSICT.json") diff --git a/help_files/upgrade_sitios_ai.py b/help_files/upgrade_sitios_ai.py index 6e134b2..875dc73 100644 --- a/help_files/upgrade_sitios_ai.py +++ b/help_files/upgrade_sitios_ai.py @@ -3,8 +3,7 @@ import json import os ip_device = os.getenv("ip_device") -db_server = json.loads(os.getenv("dist_servs")) -db_server = db_server[ip_device] +db_server = json.loads(os.getenv("dist_servs"))[ip_device] # Parámetros de conexión a la base de datos f_path = os.path.join(os.getcwd(), "json_files/sitios.json")