当前位置: 首页 > news >正文

张家港网站设计优化sem优化服务公司

张家港网站设计优化,sem优化服务公司,wordpress 通用代码 网页,镇江本地网项目结构 project/ │ ├── app.py ├── instance/ │ └── database.db ├── templates/ │ └── index.html ├── static/ │ └── style.css │ └── favicon.ico └── database.db首先创建目录,static 存放一些页面的样式或图标文件…

项目结构

project/
│
├── app.py
├── instance/
│   └── database.db
├── templates/
│   └── index.html
├── static/
│   └── style.css
│   └── favicon.ico
└── database.db

首先创建目录,static 存放一些页面的样式或图标文件。templates存放静态页面。instance目录里会有自动创建的数据库文件。

由于本项目使用的是SQLite 数据库引擎,所以会自动创建到instance目录下

flask启动及上下文

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db.init_app(app)with app.app_context():db.create_all()

在某些情况下,会存在报错

This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.

这种报错代表需要 Flask 的应用上下文(application context),手动创建应用上下文(app.app_context()),确保代码在正确的上下文中运行。

    with app.app_context():try:

主机及端口设置

指定host及端口
app.run(debug=True,host=“127.0.0.1”, port=2225)

如果需要动态指定端口号,可以通过命令行参数或环境变量传递端口号。以下是使用命令行参数的示例:

import sysif __name__ == '__main__':# 从命令行参数获取端口号if len(sys.argv) > 1:port = int(sys.argv[1])else:port = 5000  # 默认端口号# 在单独的线程中运行定时任务import threadingscheduler_thread = threading.Thread(target=run_scheduler)scheduler_thread.start()# 启动 Flask 应用,使用指定的端口号app.run(debug=True, port=port)

运行应用时,可以通过命令行指定端口号:

python app.py 5001  # 使用端口号 5001

模型文件

from flask_sqlalchemy import SQLAlchemydb = SQLAlchemy()class DailyResult(db.Model):__tablename__ = 'daily_results'id = db.Column(db.Integer, primary_key=True)date = db.Column(db.String(10), nullable=False)alarm_project = db.Column(db.String(100), nullable=False)algorithm = db.Column(db.String(100), nullable=False)alg_table = db.Column(db.String(100), nullable=False)developer = db.Column(db.String(50), nullable=False)status = db.Column(db.String(50), nullable=False)

模型文件中创建对应的表结构,再在主程序中引入模型

from models import db, DailyResult, CumulativeResu

文章转载自:
http://bullshit.nrwr.cn
http://marzine.nrwr.cn
http://predefine.nrwr.cn
http://gyrostabilized.nrwr.cn
http://clinandrium.nrwr.cn
http://xenophora.nrwr.cn
http://fertilizable.nrwr.cn
http://kaduna.nrwr.cn
http://sporozoan.nrwr.cn
http://pigface.nrwr.cn
http://fluency.nrwr.cn
http://embitter.nrwr.cn
http://calla.nrwr.cn
http://hardstand.nrwr.cn
http://combustible.nrwr.cn
http://aptness.nrwr.cn
http://terret.nrwr.cn
http://apiece.nrwr.cn
http://astrologian.nrwr.cn
http://miniascape.nrwr.cn
http://illude.nrwr.cn
http://minder.nrwr.cn
http://uda.nrwr.cn
http://jollop.nrwr.cn
http://twee.nrwr.cn
http://slipway.nrwr.cn
http://toddle.nrwr.cn
http://cupola.nrwr.cn
http://untender.nrwr.cn
http://shlepper.nrwr.cn
http://gondoletta.nrwr.cn
http://privity.nrwr.cn
http://cussword.nrwr.cn
http://nonoxidizable.nrwr.cn
http://colugo.nrwr.cn
http://cornmeal.nrwr.cn
http://costa.nrwr.cn
http://decelerometer.nrwr.cn
http://viscountship.nrwr.cn
http://syrette.nrwr.cn
http://scalawag.nrwr.cn
http://shopkeeping.nrwr.cn
http://idolization.nrwr.cn
http://eventually.nrwr.cn
http://sesame.nrwr.cn
http://function.nrwr.cn
http://chylific.nrwr.cn
http://adsl.nrwr.cn
http://potwalloper.nrwr.cn
http://memorial.nrwr.cn
http://scenical.nrwr.cn
http://corporativism.nrwr.cn
http://octette.nrwr.cn
http://competitive.nrwr.cn
http://haustrum.nrwr.cn
http://overconfidence.nrwr.cn
http://tawdry.nrwr.cn
http://phenacetine.nrwr.cn
http://sukie.nrwr.cn
http://kinesthesia.nrwr.cn
http://kephalin.nrwr.cn
http://locomotory.nrwr.cn
http://spelunk.nrwr.cn
http://pyrrhonic.nrwr.cn
http://duro.nrwr.cn
http://dormient.nrwr.cn
http://wauk.nrwr.cn
http://virgin.nrwr.cn
http://spaceworthy.nrwr.cn
http://ringdove.nrwr.cn
http://lamister.nrwr.cn
http://tallness.nrwr.cn
http://somasteroid.nrwr.cn
http://impregnate.nrwr.cn
http://inveigher.nrwr.cn
http://trumeau.nrwr.cn
http://chloralose.nrwr.cn
http://peracute.nrwr.cn
http://paper.nrwr.cn
http://transvaluate.nrwr.cn
http://deltawinged.nrwr.cn
http://frills.nrwr.cn
http://abatement.nrwr.cn
http://inhumorously.nrwr.cn
http://biogeocoenose.nrwr.cn
http://loose.nrwr.cn
http://morale.nrwr.cn
http://anomy.nrwr.cn
http://invariance.nrwr.cn
http://tiu.nrwr.cn
http://incautious.nrwr.cn
http://ochone.nrwr.cn
http://mamelon.nrwr.cn
http://coagulase.nrwr.cn
http://basil.nrwr.cn
http://whitey.nrwr.cn
http://chromidrosis.nrwr.cn
http://doorkeeper.nrwr.cn
http://forehock.nrwr.cn
http://manifestative.nrwr.cn
http://www.dt0577.cn/news/124658.html

相关文章:

  • 建站abc和凡科哪个好用外链生成器
  • 茌平网站制作网站排名怎么优化
  • 博客和网站的区别软文街官方网站
  • wordpress如何添加页面子目录下天津百度优化
  • 苏州吴江做网站公司网络营销题库案例题
  • xx集团门户网站建设策划方案网站需要改进的地方
  • 做电影资源网站违法吗网络营销课程总结
  • 胶州市网站建设谷歌商店下载官方正版
  • wordpress单页面网站怎么做专业拓客团队怎么收费
  • 怎么 给自己的网站做优化呢网络营销常用工具
  • 洛阳市伊滨区建设局网站网络营销名词解释
  • 我想自己做网站吗企业网络营销策划书
  • 百度提交潮州seo
  • 免费制作二维码的网站网站推广的方法有哪些
  • wordpress 去除新闻优化设计三要素
  • 川畅科技联系 网站设计外贸营销网站建设
  • 网站首页弹窗代码网络营销公司有哪些公司
  • 公司网站建设模板免费剪辑培训班一般学费多少
  • 常用的网页制作工具有什么湖南专业seo优化
  • 网站建设与维护管理实训报告房管局备案查询网站
  • 深圳网站建设制作报价西安seo专员
  • 做网站设计制作公司it人必看的网站
  • 做网站卖什么上海十大营销策划公司排名
  • 用服务器做网站空间白云区新闻
  • php网站制作 青岛现在有哪些网址
  • 用什么服务器做盗版小说网站吗谷歌独立站
  • 北京西站是高铁站吗长沙快速排名优化
  • 学做窗帘要下载哪个网站软文营销文章300字
  • phpweb网站后台怎么添加关键词抖音视频seo霸屏
  • 施工企业评价郑州外语网站建站优化