5 叮当猫 1天前 189次点击
我去试试
出现报错from flask import Flask, render_template, request, redirect, url_for from flask_sqlalchemy import SQLAlchemy import os app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] ='sqlite:///forum.db' db = SQLAlchemy(app) class Post(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), nullable=False) content = db.Column(db.Text, nullable=False) comments = db.relationship('Comment', backref='post', lazy=True) class Comment(db.Model): id = db.Column(db.Integer, primary_key=True) content = db.Column(db.Text, nullable=False) post_id = db.Column(db.Integer, db.ForeignKey('post.id'), nullable=False) @app.route('/') def index(): posts = Post.query.all() return render_template('index.html', posts=posts) @app.route('/create_post', methods=['GET', 'POST']) def create_post(): if request.method == 'POST': title = request.form['title'] content = request.form['content'] new_post = Post(title=title, content=content) db.session.add(new_post) db.session.commit() return redirect(url_for('index')) return render_template('create_post.html') @app.route('/post/', methods=['GET', 'POST']) def post_detail(post_id): post = Post.query.get_or_404(post_id) if request.method == 'POST': comment_content = request.form['comment'] new_comment = Comment(content=comment_content, post_id=post_id) db.session.add(new_comment) db.session.commit() return render_template('post_detail.html', post=post) @app.route('/init_db') def init_db(): db.create_all() return 'Database initialized' if __name__ == '__main__': if not os.path.exists('forum.db'): with app.app_context(): db.create_all() app.run(debug=True)以下是翻译结果网页视图从烧瓶导入Flask,render_template,请求,重定向,url_for从烧瓶_sqlalchemy导入SQLAlchemy导入操作系统应用程序=Flask(__name__)app.config['SQALCHEMY_DATABASE_URI']='sqlite://forum.db'db=SQLAlchemy(应用程序)类Post(db.Model):ID=db.Column(db.Integer,primary_key=True)title=db.Column(db.String(100),nullable=False)content=db.Column(db.Text,nullable=False)comments=db.relation('Comment',backref='post',lazy=True)类Comment(db.Model):id=db.Column(db.Integer,primary_key=True)content=db.Column(db.Text,nullable=False)post_id=db.Column(db.Integer,db.ForeignKey('post.id'),nullable=False)@app.route('/')def index():posts=Post。query.All()返回render_template('index.html',posts=posts)@app.route('/create_post',methods=['GET','POST'])def create_post():如果请求。method=='POST':title=request.form['title']content=request.form['content']new_post=Post(title=title,content=content)db。session.add(new_post)数据库。session.commit()返回重定向(url_for('index'))返回render_template('create_post.html')@app.route('/post/',methods=['GET','POST'])def post_detail(post_id):post=Post。query.get_or_404(post_id)(如果请求)。方法=='POST':comment_content=request.form['comment']new_comment=Comment(内容=comment_content,post_id=post_id)db。session.add(new_comment)session.commit()返回render_template('post_detail.html',post=post)@app.route('/init_db')def init_db():db.create_all()返回'Database initialized'如果__name__=='__main__':如果不是os。path.exists('forum.db'):使用app.app_context():db.create_all()app.run(debug=True)
你生成的是个啥?反正我试过,我这里能生成300多行。
就是跟deep sick一样的题目,让他帮我生成一颗,简单制作一个简单的论坛网站,有个发帖跟评论就可以了我生成出来后运行deepsick能用,而豆包的就直接报错
多调试几次,这就是这个AI的bug。给你少写点儿内容,多写点儿内容很正常。毕竟这个Deep sick已经干翻了很多AI了。
Deepsick正常,毕竟干翻了好多AI,甚至都让open airi都吓得惊慌失措的英伟达、亚马逊以及嗯,这个微软都接入了depsick不然正常,不然他也不至于,呃,写一次代码基本上都能运行成功的,也不会出现报错这个提示你说的确实有道理,不然他这个新的也不会,至于有些能力超越了open airi, 但是呢,至少能跟他媲美它这个超标性能也不会遭到大量的恶意攻击,这是国产国内AI大模型自发展以来罕见的第一次。也是成为恩,攻防保卫战也被许多网友即刻就博主称之为deepsick保卫战
而且能正常使用。
你这个是,嗯,写安卓系统方面的,还是运行Windows系统环境的,还是哪个环境的,你是写APP还是写网站还是写啥我只知道啊,我运行这个程序后又出现报错
抱歉,刚才没注意把文件扩展名搞错了,我再去试一下
除非说毕竟我还有我看今天是初八,然后我看一下今天是几月几日我还有24天才成年,然后呢,我去实名的时候没法实名,然后啊,我看到时候除非我只能就是啊手机上是没法运行的,但是你让我运行网站倒是可以写好的网站程序,你到时候说让我运行这个网站可以,但是手机上,但是手机上运行这个就没法用啊,我看到时候我啊去部署个云服务器过来,然后把那个环境给安装好提示啊,不然的话我就没辙,或者是啊,你一会儿你把你微信发过来,然后呢啊,我加你好友以后,我把这个呃文本文大恩,这个发给你,就是把这个代码编辑成一个文本文档以后发给你
云服务器注册要实名我现在只能在那上面安装环境,我这手机上没法运行那个环境,你说让我去运行个网站网页我可以理解,但是这个只要是Windows或者安卓以上的APP软件,我就没法运行了
没事
能不能把这个应用给我发一下QQ号。385438393
安卓鸿蒙操作系统仅在华为应用市场、小米应用商店、OPPO软件商店、VIVO应用商店、三星应用商店百度手机助手应用宝等各大应用市场搜索Deepsick若是苹果iOS系统,请在苹果store应用商店搜索deeppick下载
对啊,就是这个能不能发到我QQ上面。
安卓鸿蒙操作系统仅在华为应用市场、小米应用商店、OPPO软件商店、VIVO应用商店、三星应用商店百度手机助手应用宝等各大应用市场搜索Deepsick若是苹果iOS系统,请在苹果store应用商店搜索deeppick下载
这这这里好像不能分享代码,你去试一下,我这边没有那个环境
在豆包里好像也能用吧。