Docker buid issue
This commit is contained in:
@ -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)
|
||||||
from app.services.services import serial_service
|
# Only attempt connection if ENABLE_SERIAL is set to true
|
||||||
try:
|
if os.getenv('ENABLE_SERIAL', 'false').lower() == 'true':
|
||||||
connected = serial_service.connect_to_machine('/dev/ttyUSB0', 9600)
|
from app.services.services import serial_service
|
||||||
if connected:
|
try:
|
||||||
print("✓ Vending machine connected successfully")
|
connected = serial_service.connect_to_machine('/dev/ttyUSB0', 9600)
|
||||||
else:
|
if connected:
|
||||||
print("✗ Failed to connect to vending machine")
|
print("✓ Vending machine connected successfully")
|
||||||
except Exception as e:
|
else:
|
||||||
print(f"⚠ Serial connection error: {e}")
|
print("⚠ Vending machine not connected (device may not be available)")
|
||||||
|
except Exception as 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
|
||||||
|
|||||||
@ -5,4 +5,5 @@ python-dotenv
|
|||||||
pymysql
|
pymysql
|
||||||
gunicorn
|
gunicorn
|
||||||
cryptography
|
cryptography
|
||||||
pyserial
|
pyserial
|
||||||
|
PyJWT
|
||||||
Reference in New Issue
Block a user