[Flask] Problem with Flask-Admin

Lorenzo Mainardi lormayna at gmail.com
Tue May 10 16:47:02 EDT 2016


Thank you, now it seems working fine.


2016-05-10 14:47 GMT+02:00 Andrea D'Amore <and.damore at gmail.com>:

> On 9 May 2016 at 22:06, Lorenzo Mainardi <lormayna at gmail.com> wrote:
> > You can find the code here:
> > https://bitbucket.org/lormayna/digi_task
>
> > This is print dir(models): ['__builtins__', '__doc__', '__file__',
> > '__name__', '__package__']
> > This is print models.__file__:
> > /home/lorenzo/projects/digitel_task/app/models.pyc
>
> I don't understand exactly what the issue is but I think it's a
> circular dependency one between app and models modules: app.py is
> importing from models.py that is importing from app.
> If you put print dir(models) just under "import models" in app.py you
> can see in the output that it's run twice, the first time the module
> has no attributes, and that's where you're getting the runtime error.
> The second time the models module is correctly showing the classes you
> defined, and that's the one you get if you try the code in an
> interactive interpreter and then try to manually execute
> admin.add_view() with models.Status, at that point models module is
> populated.
>
>
> --
> Andrea
>



-- 
LORENZO MAINARDI
http://blog.mainardi.me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20160510/960c54b8/attachment.html>


More information about the Flask mailing list