[Flask] Problem with Flask-Admin

Lorenzo Mainardi lormayna at gmail.com
Mon May 9 16:06:52 EDT 2016


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

2016-05-09 13:52 GMT+02:00 Anthony Ford <ford.anthonyj at gmail.com>:

> Um.. Then where's main.py?
>
> Can you paste as much of your app as you can disclose into a
> Gist/Pastebin? Or possibly a github/gitlab repo?
>
> Your app.py doesn't have the models import, so we can't see how things are
> imported there.
>
> Can you add a "print dir(models)" at the top of your main.py (after the
> import of course)? Just to see what's in that module.
> Also, like Andrea suggested, print models.__file__ as well. Just so we can
> make sure you are importing the file you think you are.
>
>
> Anthony Ford,
> KF5IBN,
> ford.anthonyj at gmail.com
>
> On Mon, May 9, 2016 at 4:51 AM, Lorenzo Mainardi <lormayna at gmail.com>
> wrote:
>
>> This is my model.py file:
>>
>> (digitel_task)lorenzo at wolf:~/projects/digitel_task/app$ cat models.py
>>
>> from app import app,db
>> class Task(db.Model):
>> id = db.Column(db.Integer, primary_key=True)
>> name = db.Column(db.String(40), unique=True)
>> start_time = db.Column(db.DateTime)
>> dpc = db.Column(db.DateTime)
>> duc = db.Column(db.DateTime)
>> end_time = db.Column(db.DateTime)
>> tech_priority = db.Column(db.Integer,
>> db.CheckConstraint('tech_priority>0'),
>> db.CheckConstraint('tech_priority<3'))
>> sales_priority = db.Column(db.Integer,
>> db.CheckConstraint('tech_priority>0'),
>> db.CheckConstraint('tech_priority<3'))
>> description = db.Column(db.String(3000), unique=True)
>> src_ip = db.Column(db.String(16), unique=True)
>> class Employer(db.Model):
>> id = db.Column(db.Integer, primary_key=True)
>> name = db.Column(db.String(50), unique=True)
>> class Status(db.Model):
>> id = db.Column(db.Integer, primary_key=True)
>> status = db.Column(db.String(50), unique=True)
>> color = db.Column(db.String, unique = True)
>> class MacroProject(db.Model):
>> id = db.Column(db.Integer, primary_key=True)
>> name = db.Column(db.String(40), unique=True)
>>
>> 2016-05-08 18:07 GMT+02:00 Andrea D'Amore <and.damore at gmail.com>:
>>
>>> On 8 May 2016 at 00:18, Lorenzo Mainardi <lormayna at gmail.com> wrote:
>>> > AttributeError: 'module' object has no attribute 'Status'
>>> >
>>> > I really don't know where is the problem.
>>> > Could you help me?
>>>
>>> You need to paste (or attach if pasting isn't feasible) models.py,
>>> seems you think to have derived a SQLAlchemy Model there but the
>>> interpreter doesn't agree.
>>>
>>> As odd as it is you might be importing a "models" package from global
>>> site-package, what does models.__file__ say?
>>>
>>>
>>> --
>>> Andrea
>>>
>>
>>
>>
>> --
>> LORENZO MAINARDI
>> http://blog.mainardi.me
>>
>> _______________________________________________
>> Flask mailing list
>> Flask at python.org
>> https://mail.python.org/mailman/listinfo/flask
>>
>>
>


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


More information about the Flask mailing list