Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
flush prints
remove debug flag
  • Loading branch information
LucifersCircle committed Dec 7, 2024
1 parent cb0e69b commit 69f4384
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@

# Function to initialize the database if it doesn't exist
def initialize_db():
print(f"Initializing database at: {DB_FILE}")
print(f"Initializing database at: {DB_FILE}", flush=True)
if os.path.exists(DB_FILE) and not os.path.isfile(DB_FILE):
print(f"Error: {DB_FILE} exists but is not a file and cannot be removed automatically.")
print("Please remove it manually and restart the application.")
print(f"Error: {DB_FILE} exists but is not a file and cannot be removed automatically.", flush=True)
print("Please remove it manually and restart the application.", flush=True)
return

if not os.path.exists(DB_FILE):
print(f"Database file does not exist. Creating a new one at: {DB_FILE}")
print(f"Database file does not exist. Creating a new one at: {DB_FILE}", flush=True)
try:
conn = sqlite3.connect(DB_FILE)
conn.execute('''
Expand All @@ -39,9 +39,9 @@ def initialize_db():
''')
conn.commit()
conn.close()
print("Database initialized successfully.")
print("Database initialized successfully.", flush=True)
except Exception as e:
print(f"Error initializing database: {e}")
print(f"Error initializing database: {e}", flush=True)

# Initialize database on startup
initialize_db()
Expand Down Expand Up @@ -214,7 +214,7 @@ def manage_key():
return render_template_string(HTML_TEMPLATE, message=message)

except Exception as e:
print(f"Error managing key: {e}")
print(f"Error managing key: {e}", flush=True)
if is_api_request:
return jsonify({'error': str(e)}), 500
message = f"An error occurred: {e}"
Expand All @@ -226,4 +226,4 @@ def manage_key():


if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)
app.run(host='0.0.0.0', port=5000)

0 comments on commit 69f4384

Please sign in to comment.