[Flask] Flask-pymongo

Lars Peter Søndergaard lps at chireiden.net
Sat Aug 15 14:48:30 CEST 2015


Am Sat, 15 Aug 2015 06:41:02 +0800
schrieb west alto <westalto at gmail.com>:


>    6.             from api.v1.profile.views import profile_v1_bp
>    7.
>    8.             api = Flask(__name__)
>    9.             api.config.from_object('config')
>    10.             api.config.from_envvar('API_CONFIG_FILE')
>    11.             mongo = PyMongo(api)

Probably because you import your views, before mongo has been defined.
If you change the order, that is, importing your views after defining
mongo it should work.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digitale Signatur von OpenPGP
URL: <http://mail.python.org/pipermail/flask/attachments/20150815/d7810b28/attachment.sig>


More information about the Flask mailing list