'update
This commit is contained in:
14
database.py
Normal file
14
database.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
# 使用 mysqlclient
|
||||
# SQLALCHEMY_DATABASE_URL = "mysql://username:password@localhost/weather_db"
|
||||
|
||||
# 使用 PyMySQL
|
||||
SQLALCHEMY_DATABASE_URL = "mysql+pymysql://hackrobot:Xiao4669805@101.42.43.245:3400/hackrobot"
|
||||
|
||||
engine = create_engine(SQLALCHEMY_DATABASE_URL, pool_pre_ping=True)
|
||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
|
||||
Base = declarative_base()
|
||||
Reference in New Issue
Block a user