DataBaseConfig.py 937 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import os
  2. from sqlalchemy import create_engine
  3. os_env_code_status = os.getenv('LYY_STATUS', 'product')
  4. if os_env_code_status == 'dev':
  5. # 测试数据库连接字符串
  6. print("测试环境--数据库!")
  7. host = "139.186.151.174"
  8. port = 3306
  9. user = "hcst"
  10. passwd = "hcst@2020"
  11. db = 'jeecg-boot'
  12. charset = 'utf8'
  13. db_con_str = "mysql+pymysql://%s:%s@%s:%d/%s" % ("hcst", "hcst@2020", "139.186.151.174", 3306, "jeecg-boot")
  14. engine = create_engine(db_con_str, connect_args={'charset': 'utf8'})
  15. else:
  16. # 线上数据库连接字符串
  17. print("生产环境--数据库!")
  18. host = "139.186.27.96"
  19. port = 4000
  20. user = "data"
  21. passwd = "hcst@2021"
  22. db = 'jeecg-boot'
  23. charset = 'utf8'
  24. db_con_str = "mysql+pymysql://%s:%s@%s:%d/%s" % ("data", "hcst@2021", "139.186.27.96", 4000, "jeecg-boot")
  25. engine = create_engine(db_con_str, connect_args={'charset': 'utf8'})