Docker buid issue

This commit is contained in:
2025-10-17 11:32:24 +05:30
parent aa583013bc
commit f7550653c0
2 changed files with 16 additions and 11 deletions

View File

@ -65,16 +65,20 @@ def create_app():
db.create_all() db.create_all()
print(f"✓ Database initialized ({flask_env})") print(f"✓ Database initialized ({flask_env})")
# FIXED: Serial service connection BEFORE return # OPTIONAL: Serial service connection (non-blocking)
# Only attempt connection if ENABLE_SERIAL is set to true
if os.getenv('ENABLE_SERIAL', 'false').lower() == 'true':
from app.services.services import serial_service from app.services.services import serial_service
try: try:
connected = serial_service.connect_to_machine('/dev/ttyUSB0', 9600) connected = serial_service.connect_to_machine('/dev/ttyUSB0', 9600)
if connected: if connected:
print("✓ Vending machine connected successfully") print("✓ Vending machine connected successfully")
else: else:
print("✗ Failed to connect to vending machine") print("⚠ Vending machine not connected (device may not be available)")
except Exception as e: except Exception as e:
print(f"⚠ Serial connection error: {e}") print(f"⚠ Serial connection skipped: {e}")
else:
print(" Serial connection disabled (set ENABLE_SERIAL=true to enable)")
# Register blueprints # Register blueprints
from app.routes.routes import bp from app.routes.routes import bp

View File

@ -6,3 +6,4 @@ pymysql
gunicorn gunicorn
cryptography cryptography
pyserial pyserial
PyJWT