简体   繁体   English

Linux服务器上的PyMongo和Flask

[英]PyMongo and Flask on Linux server

I'm trying to connect to connect to my MongoDB instance from my FLASK app and I've run into an issue. 我正在尝试从FLASK应用程序连接到MongoDB实例,但遇到了问题。 I followed the tutorial at https://flask-pymongo.readthedocs.org/en/latest/ 我遵循了https://flask-pymongo.readthedocs.org/en/latest/上的教程。

When I try to run the server I get the following error: ImportError: No module named flask.ext.pymongo 当我尝试运行服务器时,出现以下错误: ImportError: No module named flask.ext.pymongo

I've ran pip install Flask-PyMongo . 我已经运行了pip install Flask-PyMongo The code fails when I try to import PyMongo using from flask.ext.pymongo import PyMongo 当我尝试from flask.ext.pymongo import PyMongo时,代码失败

Turns out the solution to the problem was that I needed to download Flask-PyMongo to my projects local libs folder using pip install -t lib Flask-PyMongo 原来该问题的解决方案是我需要使用pip install -t lib Flask-PyMongo将Flask-PyMongo下载到我的项目本地libs文件夹中

This is due to the line in my config file vendor.add('lib') 这是由于我的配置文件vendor.add('lib')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM