资源加载中... loading...

自定义多用户量化平台问题

Author: 叶子, Created: 2018-07-06 16:47:08, Updated:

注册完信息点击“注册”出现一下错误: sqlalchemy.exc.IntegrityError IntegrityError: (sqlite3.IntegrityError) UNIQUE constraint failed: user.username [SQL: u’INSERT INTO user (username, email, password, date) VALUES (?, ?, ?, ?)’] [parameters: (u’test’, u'123456@qq.com’, ‘6ffd87ffa2daf5192c0a2b891bf8daf7’, ‘2018-07-06 16:45:34.112000’)] (Background on this error at: http://sqlalche.me/e/gkpj)

Traceback (most recent call last) File “C:\Python27\lib\site-packages\flask\app.py”, line 1997, in call return self.wsgi_app(environ, start_response) File “C:\Python27\lib\site-packages\flask\app.py”, line 1985, in wsgi_app response = self.handle_exception(e) File “C:\Python27\lib\site-packages\flask\app.py”, line 1540, in handle_exception reraise(exc_type, exc_value, tb) File “C:\Python27\lib\site-packages\flask\app.py”, line 1982, in wsgi_app ctx = self.request_context(environ) ctx.push() error = None try: try: response = self.full_dispatch_request() except Exception as e: error = e response = self.handle_exception(e) except: error = sys.exc_info()[1] File “C:\Python27\lib\site-packages\flask\app.py”, line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File “C:\Python27\lib\site-packages\flask\app.py”, line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File “C:\Python27\lib\site-packages\flask\app.py”, line 1612, in full_dispatch_request rv = self.dispatch_request() File “C:\Python27\lib\site-packages\flask\app.py”, line 1598, in dispatch_request return self.view_functionsrule.endpoint File “C:\Users\maker04\Desktop\fmz_extend_api_demo-master\app.py”, line 171, in signup db.session.commit() File “C:\Python27\lib\site-packages\sqlalchemy\orm\scoping.py”, line 153, in do return getattr(self.registry(), name)(*args, **kwargs) File “C:\Python27\lib\site-packages\sqlalchemy\orm\session.py”, line 943, in commit self.transaction.commit() File “C:\Python27\lib\site-packages\sqlalchemy\orm\session.py”, line 467, in commit self._prepare_impl() File “C:\Python27\lib\site-packages\sqlalchemy\orm\session.py”, line 447, in _prepare_impl self.session.flush() File “C:\Python27\lib\site-packages\sqlalchemy\orm\session.py”, line 2254, in flush self._flush(objects) File “C:\Python27\lib\site-packages\sqlalchemy\orm\session.py”, line 2380, in _flush transaction.rollback(_capture_exception=True) File “C:\Python27\lib\site-packages\sqlalchemy\util\langhelpers.py”, line 66, in exit compat.reraise(exc_type, exc_value, exc_tb) File “C:\Python27\lib\site-packages\sqlalchemy\orm\session.py”, line 2344, in _flush flush_context.execute() File “C:\Python27\lib\site-packages\sqlalchemy\orm\unitofwork.py”, line 391, in execute rec.execute(self) File “C:\Python27\lib\site-packages\sqlalchemy\orm\unitofwork.py”, line 556, in execute uow File “C:\Python27\lib\site-packages\sqlalchemy\orm\persistence.py”, line 181, in save_obj mapper, table, insert) File “C:\Python27\lib\site-packages\sqlalchemy\orm\persistence.py”, line 866, in _emit_insert_statements execute(statement, params) File “C:\Python27\lib\site-packages\sqlalchemy\engine\base.py”, line 948, in execute return meth(self, multiparams, params) File “C:\Python27\lib\site-packages\sqlalchemy\sql\elements.py”, line 269, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File “C:\Python27\lib\site-packages\sqlalchemy\engine\base.py”, line 1060, in _execute_clauseelement compiled_sql, distilled_params File “C:\Python27\lib\site-packages\sqlalchemy\engine\base.py”, line 1200, in _execute_context context) File “C:\Python27\lib\site-packages\sqlalchemy\engine\base.py”, line 1413, in _handle_dbapi_exception exc_info File “C:\Python27\lib\site-packages\sqlalchemy\util\compat.py”, line 265, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File “C:\Python27\lib\site-packages\sqlalchemy\engine\base.py”, line 1193, in _execute_context context) File “C:\Python27\lib\site-packages\sqlalchemy\engine\default.py”, line 509, in do_execute cursor.execute(statement, parameters) IntegrityError: (sqlite3.IntegrityError) UNIQUE constraint failed: user.username [SQL: u’INSERT INTO user (username, email, password, date) VALUES (?, ?, ?, ?)’] [parameters: (u’test’, u'123456@qq.com’, ‘6ffd87ffa2daf5192c0a2b891bf8daf7’, ‘2018-07-06 16:45:34.112000’)] (Background on this error at: http://sqlalche.me/e/gkpj) The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the “Traceback” headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

可能是什么原因。 dump() shows all variables in the frame dump(obj) dumps all that’s known about the object


More

发明者量化-小小梦 https://www.fmz.com/bbs-topic/1697 https://dn-filebox.qbox.me/57fdf155a634270e991f5157ea6c733de637cb5e.png 这个帖子上讲述的 DEMO 只是个 范例,具体功能 和 量化平台还需要设计的。