RANA
commited on
Commit
•
eddd084
1
Parent(s):
bb6bac9
connection issue 6
Browse files- __pycache__/config.cpython-39.pyc +0 -0
- app.py +1 -9
- config.py +2 -2
- models/__pycache__/model_ir.cpython-39.pyc +0 -0
- models/__pycache__/scrapper.cpython-39.pyc +0 -0
- requirements.txt +1 -0
__pycache__/config.cpython-39.pyc
ADDED
Binary file (317 Bytes). View file
|
|
app.py
CHANGED
@@ -20,16 +20,11 @@ mongo = PyMongo(app)
|
|
20 |
|
21 |
def test_db_connection():
|
22 |
try:
|
23 |
-
print("STARTING VERIFICATION")
|
24 |
# Try to perform a simple query to check if the database connection is working
|
25 |
-
|
26 |
-
print(value)
|
27 |
-
print("ENDED VERIFICATION")
|
28 |
-
|
29 |
# If the query above doesn't raise an exception, the connection is successful
|
30 |
return True
|
31 |
except Exception as e:
|
32 |
-
print("ERROR")
|
33 |
# If any exception occurs during the database query, the connection is not successful
|
34 |
return False
|
35 |
|
@@ -342,15 +337,12 @@ def post_counts():
|
|
342 |
|
343 |
|
344 |
if __name__ == "__main__":
|
345 |
-
print("Database connection Checking.")
|
346 |
try:
|
347 |
with app.app_context():
|
348 |
# Check the database connection before running the application
|
349 |
if test_db_connection():
|
350 |
-
print("Database connection.")
|
351 |
app.run()
|
352 |
else:
|
353 |
print("Database connection failed.")
|
354 |
except Exception as e:
|
355 |
-
print("ERRORRRRR")
|
356 |
print(e)
|
|
|
20 |
|
21 |
def test_db_connection():
|
22 |
try:
|
|
|
23 |
# Try to perform a simple query to check if the database connection is working
|
24 |
+
mongo.db.users.find_one() # Replace 'users' with the name of any existing collection in your database
|
|
|
|
|
|
|
25 |
# If the query above doesn't raise an exception, the connection is successful
|
26 |
return True
|
27 |
except Exception as e:
|
|
|
28 |
# If any exception occurs during the database query, the connection is not successful
|
29 |
return False
|
30 |
|
|
|
337 |
|
338 |
|
339 |
if __name__ == "__main__":
|
|
|
340 |
try:
|
341 |
with app.app_context():
|
342 |
# Check the database connection before running the application
|
343 |
if test_db_connection():
|
|
|
344 |
app.run()
|
345 |
else:
|
346 |
print("Database connection failed.")
|
347 |
except Exception as e:
|
|
|
348 |
print(e)
|
config.py
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
|
2 |
-
DATABASE_URI = "mongodb+srv://muhammadwasilshahzad:OEFB4lmmG1ermd48@cluster0.3rosld4.mongodb.net/?retryWrites=true&w=majority"
|
3 |
SECRET_KEY = "badjskgujaiksgdjksagdjasgdkjhgsajkdhg11232132145"
|
|
|
1 |
+
DATABASE_URI = "mongodb+srv://muhammadwasilshahzad:OEFB4lmmG1ermd48@cluster0.3rosld4.mongodb.net/ARAZIM"
|
2 |
+
# DATABASE_URI = "mongodb+srv://muhammadwasilshahzad:OEFB4lmmG1ermd48@cluster0.3rosld4.mongodb.net/?retryWrites=true&w=majority"
|
3 |
SECRET_KEY = "badjskgujaiksgdjksagdjasgdkjhgsajkdhg11232132145"
|
models/__pycache__/model_ir.cpython-39.pyc
ADDED
Binary file (2.55 kB). View file
|
|
models/__pycache__/scrapper.cpython-39.pyc
ADDED
Binary file (2.45 kB). View file
|
|
requirements.txt
CHANGED
@@ -16,6 +16,7 @@ Flask==2.3.2
|
|
16 |
Flask-PyMongo==2.3.0
|
17 |
gitdb==4.0.10
|
18 |
GitPython==3.1.31
|
|
|
19 |
grpcio==1.54.0
|
20 |
h11==0.14.0
|
21 |
h5py==3.1.0
|
|
|
16 |
Flask-PyMongo==2.3.0
|
17 |
gitdb==4.0.10
|
18 |
GitPython==3.1.31
|
19 |
+
gunicorn==21.2.0
|
20 |
grpcio==1.54.0
|
21 |
h11==0.14.0
|
22 |
h5py==3.1.0
|