Closed labike closed 3 years ago
I think this must have to do with the structure of your project. Can you provide a complete example? Feel free to create a repo on GitHub with all the code.
@miguelgrinberg thanks, I will upload my completed project in my git repository.
@miguelgrinberg i'm network terrible and code too large, so i upload my cloud, i don't know can you download? thank you very much!
Sorry, but the download does not work. Can you please simplify your application so that it can be uploaded to github? Thanks.
@miguelgrinberg ok, i'm try again.
@miguelgrinberg i'm delete static source, rest python code and html. repository i'm upload all source code to google drive and share you. thanks help me!!!
Everything works for me. Here is a copy of my test:
>>> from app import db
>>> from app.models import Role, Admin
>>> db.create_all()
>>> role = Role(name='admin', auths='')
>>> db.session.add(role)
>>> db.session.commit()
>>> role.id
1
>>> admin = Admin(name='admin', pwd='123', is_super=0, role_id=1)
>>> db.session.add(admin)
>>> db.session.commit()
>>> Admin.query.all()
[<Admin 'admin'>]
@miguelgrinberg thanks! may be db migration has error.
when i try insert admin or role, i get the error:
and before, i use
db.metadata.clear()
clear db mapping. i don't know the error in where, Can you help me see where the error? thanks miguelgrinberg!!!models.py