Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try upgrade mongoengine #23

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.test.sample
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ [email protected]
ADMIN_INITIAL_PASSWORD=change_me

# mongodb database
MONGODB_URI="mongomock://moeflow:[email protected]:27017/moeflow_test?authSource=admin"
MONGODB_URI="mongodb://moeflow:[email protected]:27017/moeflow_test?authSource=admin"

# celery job queue
CELERY_BROKER_URL="amqp://moeflow:[email protected]:5672/moeflow" # takes precedence over other RABBITMQ_* entries
Expand Down
5 changes: 5 additions & 0 deletions app/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ def connect_db(config):
logger.info("Connect mongodb")
uri = config["DB_URI"]
logger.debug(" - $DB_URI: {}".format(uri))
if config.get("TESTING"):
import mongomock

return connect(host=uri, mongo_client_class=mongomock.MongoClient)

return connect(host=uri)


Expand Down
2 changes: 1 addition & 1 deletion deps-top.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pytest-html==4.1.1
pytest-md==0.2.0

flask-babel==1.0.0 # i18n
mongoengine==0.20.0 # Mongo数据库
mongoengine==0.29.1 # Mongo数据库
mongomock==4.1.2
Pillow==8.0.1 # 图片处理
marshmallow==3.0.0b20 # 字段验证 (flask-apikit需要)
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ google-cloud-storage==1.33.0
urllib3==1.25.11
gunicorn==20.0.4
setuptools==65.5.0
mongoengine==0.20.0
pymongo==3.13.0
mongoengine==0.29.1
pymongo==4.10.1
dnspython==2.7.0
mongomock==4.1.2
packaging==24.1
sentinels==1.0.0
Expand Down
Loading