Spaces:
Running
Running
Upload 10 files
Browse files
main.py
CHANGED
@@ -52,9 +52,15 @@ async def startup_db_client():
|
|
52 |
raise Exception(error_msg)
|
53 |
|
54 |
try:
|
55 |
-
# Use the
|
56 |
print(f"Connecting to Turso database at: {db_url}")
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
# Test connection
|
60 |
result = app.db_conn.execute("SELECT 1").fetchone()
|
|
|
52 |
raise Exception(error_msg)
|
53 |
|
54 |
try:
|
55 |
+
# Use the URL with embedded auth token
|
56 |
print(f"Connecting to Turso database at: {db_url}")
|
57 |
+
# Format the URL to include the auth token
|
58 |
+
if "?" in db_url:
|
59 |
+
connection_url = f"{db_url}&authToken={auth_token.strip()}"
|
60 |
+
else:
|
61 |
+
connection_url = f"{db_url}?authToken={auth_token.strip()}"
|
62 |
+
|
63 |
+
app.db_conn = libsql.connect(connection_url)
|
64 |
|
65 |
# Test connection
|
66 |
result = app.db_conn.execute("SELECT 1").fetchone()
|