请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

返回200但是数据库没写入

class User(Base):
   id = Column(Integer, primary_key=True)
   email = Column(String(24), unique=True, nullable=False)
   nickname = Column(String(24), unique=True)
   auth = Column(SmallInteger, default=1)
   _password = Column('password', String(100))

   @property
   def password(self):
       return self._password

   @password.setter
   def set_password(self, raw):
       self._password = generate_password_hash(raw)

   @staticmethod
   def register_by_email(nickname, account, secret):
       with db.auto_commit():
           user = User()
           user.nickname = nickname
           user.email = account
           user.password = secret
           db.session.add(user) 



* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

 * Restarting with stat

 * Debugger is active!

 * Debugger PIN: 273-761-747

127.0.0.1 - - [19/Aug/2018 12:37:28] "POST /v1/client/register HTTP/1.1" 200 -

127.0.0.1 - - [19/Aug/2018 12:38:49] "POST /v1/client/register HTTP/1.1" 200 

post:

{"account":"777@qq.com", "secret":"123456", "type":999, "nickname":"natume"}


//img1.sycdn.imooc.com//szimg/5b78f4ef0001a2cf13480176.jpg

正在回答 回答被采纳积分+3

插入代码

1回答

7七月 2018-08-20 03:04:03

这个需要调试下,看是看不出问题的

0 回复 有任何疑惑可以回复我~
  • 提问者 夏目鲸鱼 #1
    怎么调试呢?
    回复 有任何疑惑可以回复我~ 2018-08-20 10:11:11
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号