-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_app.py
More file actions
60 lines (50 loc) · 1.7 KB
/
Copy pathrun_app.py
File metadata and controls
60 lines (50 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Startup script for the Chemical Engineering Thermodynamics Toolkit
@author: Bryan Piguave Llano
"""
import os
import sys
import webbrowser
import time
from threading import Timer
def open_browser():
"""Open the web browser to the application"""
webbrowser.open('http://localhost:5000')
def main():
"""Main function to start the application"""
print("🚀 Starting Chemical Engineering Thermodynamics Toolkit...")
print("=" * 60)
# Check if required packages are installed
try:
import flask
import numpy
import iapws
print("✅ All required packages are installed")
except ImportError as e:
print(f"❌ Missing package: {e}")
print("Please install requirements with: pip install -r requirements.txt")
return
# Start the Flask application
try:
from app.app import app
# Open browser after 2 seconds
Timer(2.0, open_browser).start()
print("🌐 Starting web server...")
print("📊 Available tools:")
print(" • Rankine Cycle Analysis")
print(" • Brayton Cycle Analysis")
print(" • Steam Properties Calculator")
print(" • VLE Calculator")
print(" • Refrigeration Cycle Analysis")
print("\n🔗 Opening browser to: http://localhost:5000")
print("⏹️ Press Ctrl+C to stop the server")
print("=" * 60)
# Run the Flask app
app.run(debug=False, host='0.0.0.0', port=5000)
except Exception as e:
print(f"❌ Error starting application: {e}")
return
if __name__ == "__main__":
main()