This commit is contained in:
livindra 2026-04-28 21:04:01 +07:00
parent bd1955e085
commit 910e929394
2 changed files with 7 additions and 2 deletions

2
app.py
View File

@ -911,6 +911,6 @@ def export_excel():
if __name__ == '__main__': if __name__ == '__main__':
port = os.environ.get('PORT', 5000) port = int(os.environ.get('PORT', 5000))
debug = os.environ.get('FLASK_DEBUG', '0') == '1' debug = os.environ.get('FLASK_DEBUG', '0') == '1'
app.run(host='0.0.0.0', port=port, debug=debug) app.run(host='0.0.0.0', port=port, debug=debug)

View File

@ -13,12 +13,17 @@ from pymysql import MySQLError
load_dotenv() load_dotenv()
DB_HOST = os.environ.get('DB_HOST', 'localhost') DB_HOST = os.environ.get('DB_HOST', 'localhost')
DB_PORT = os.environ.get('DB_PORT', '3306') DB_PORT = os.environ.get('DB_PORT', '3306')
try:
DB_PORT = int(DB_PORT)
except:
DB_PORT = 3306
DB_USER = os.environ.get('DB_USER', 'root') DB_USER = os.environ.get('DB_USER', 'root')
DB_PASSWORD = os.environ.get('DB_PASSWORD', '') DB_PASSWORD = os.environ.get('DB_PASSWORD', '')
DB_NAME = os.environ.get('DB_NAME', 'deteksi_pmk') DB_NAME = os.environ.get('DB_NAME', 'deteksi_pmk')
def create_database(): def create_database():
"""Create database if not exists""" """Create database if not exists"""
try: try: