Update app.py
Browse files
app.py
CHANGED
@@ -36,13 +36,20 @@ except Exception as e:
|
|
36 |
raise
|
37 |
|
38 |
# MongoDB API configuration for text analysis results
|
39 |
-
mongo_connection_string = os.environ.get("MONGODB_CONNECTION_STRING")
|
|
|
|
|
40 |
if not mongo_connection_string:
|
41 |
raise ValueError("La variable de entorno MONGODB_CONNECTION_STRING debe estar configurada")
|
42 |
|
43 |
try:
|
|
|
44 |
mongo_client = MongoClient(mongo_connection_string)
|
|
|
|
|
45 |
mongo_db = mongo_client['aideatext_db']
|
|
|
|
|
46 |
analysis_collection = mongo_db['text_analysis']
|
47 |
|
48 |
# Prueba de conexión
|
|
|
36 |
raise
|
37 |
|
38 |
# MongoDB API configuration for text analysis results
|
39 |
+
#mongo_connection_string = os.environ.get("MONGODB_CONNECTION_STRING")
|
40 |
+
cosmos_mongodb_connection_string = os.getenv("MONGODB_CONNECTION_STRING")
|
41 |
+
|
42 |
if not mongo_connection_string:
|
43 |
raise ValueError("La variable de entorno MONGODB_CONNECTION_STRING debe estar configurada")
|
44 |
|
45 |
try:
|
46 |
+
#Crear el cliente de MongoDB
|
47 |
mongo_client = MongoClient(mongo_connection_string)
|
48 |
+
|
49 |
+
#Seleccionar la base de datos
|
50 |
mongo_db = mongo_client['aideatext_db']
|
51 |
+
|
52 |
+
#Seleccionar o crear la colección
|
53 |
analysis_collection = mongo_db['text_analysis']
|
54 |
|
55 |
# Prueba de conexión
|