Import loop with MongoEngine
- Chris Higgins
- 2012-10-22 @ 21:32
-----BEGIN PGP SIGNED MESSAGE-----
Sorry if this is something that is a little more simple to Flask or
Python, I?m still a little bit of a noob with Python. I?m using
flask-mongoengine to interact with my database, which I define in my
In that file, I also require my views.py file
which in turn requires stuff from my models.py file
which tries to import db from __init__.py. I?m basically creating a
loop of imports, so whenever I try to run the server straight from
command line, I get the following error http://pastebin.com/G5u9KX2F.
Not really sure where to go from here, I haven?t had a whole lot of
Flask/Python experience, so any help and advice would be appreciated.
Student, Systems Administrator, Programmer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
-----END PGP SIGNATURE-----
Re: [flask] Import loop with MongoEngine
- Steven Kryskalla
- 2012-10-22 @ 21:36
On Mon, Oct 22, 2012 at 2:32 PM, Chris Higgins <email@example.com> wrote:
> which tries to import db from __init__.py. I?m basically creating a
> loop of imports, so whenever I try to run the server straight from
> command line, I get the following error http://pastebin.com/G5u9KX2F.
> Not really sure where to go from here, I haven?t had a whole lot of
> Flask/Python experience, so any help and advice would be appreciated.
I didn't look at your code but it sounds like you're doing a circular
import. Try moving the import that's causing the problem to:
1. the bottom of the file
2. inside the first function it gets used from
There is a little description here of the problem: