fy0 / myctf

A ctf competition program.
MIT License
27 stars 14 forks source link

数据库问题,不能新建用户 #2

Open fengzhengzhan opened 4 years ago

fengzhengzhan commented 4 years ago

Server started at port 9000 ERROR:tornado.application:Uncaught exception POST /signup (223.98.217.101) HTTPServerRequest(protocol='http', host='47.240.40.250:9000', method='POST', uri='/signup', version='HTTP/1.1', remote_ip='223.98.217.101') Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/peewee.py", line 3057, in execute_sql cursor.execute(sql, params or ()) sqlite3.OperationalError: attempt to write a readonly database

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 1697, in _execute result = method(self.path_args, self.path_kwargs) File "/home/myctf/view/user.py", line 60, in post u = User.new(username, password) File "/home/myctf/model/user.py", line 37, in new return cls.create(username=username, password=password_final, salt=salt, level=level) File "/usr/local/lib/python3.5/dist-packages/peewee.py", line 6235, in create inst.save(force_insert=True) File "/usr/local/lib/python3.5/dist-packages/peewee.py", line 6433, in save pk = self.insert(field_dict).execute() File "/usr/local/lib/python3.5/dist-packages/peewee.py", line 1845, in inner return method(self, database, args, *kwargs) File "/usr/local/lib/python3.5/dist-packages/peewee.py", line 1916, in execute return self._execute(database) File "/usr/local/lib/python3.5/dist-packages/peewee.py", line 2665, in _execute return super(Insert, self)._execute(database) File "/usr/local/lib/python3.5/dist-packages/peewee.py", line 2400, in _execute cursor = database.execute(self) File "/usr/local/lib/python3.5/dist-packages/peewee.py", line 3070, in execute return self.execute_sql(sql, params, commit=commit) File "/usr/local/lib/python3.5/dist-packages/peewee.py", line 3064, in execute_sql self.commit() File "/usr/local/lib/python3.5/dist-packages/peewee.py", line 2831, in exit reraise(new_type, new_type(exc_value, exc_args), traceback) File "/usr/local/lib/python3.5/dist-packages/peewee.py", line 183, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.5/dist-packages/peewee.py", line 3057, in execute_sql cursor.execute(sql, params or ()) peewee.OperationalError: attempt to write a readonly database ERROR:tornado.access:500 POST /signup (223.98.217.101) 7.27ms

系统环境:ubantu16.04 python 3.5

fy0 commented 4 years ago

看报错是 attempt to write a readonly database 如何复现?

fengzhengzhan commented 4 years ago

可以了,请问大佬,数据库数据能查看吗?

fy0 commented 4 years ago

可以啊 就那个db文件就是

fengzhengzhan commented 4 years ago

谢谢大佬,感谢大佬的付出

fengzhengzhan commented 4 years ago

大佬,这个网站可以挂服务器上一直运行吗?我用的ubantu16.04,我运行了之后,关闭网页,网站就不能登陆了,只能开着网页才能使用吗?

fengzhengzhan commented 4 years ago

nohup python -u app.py > out.log 2>&1 & 不太会ubantu,这个是长期运行的指令,把后台log输出到out.log中

fy0 commented 4 years ago

不用 长期运行有多种方式,最简单的nohup、tmux/screen运行,常用的比如systemd、supervisord