惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
F
Full Disclosure
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
Engineering at Meta
Engineering at Meta
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Threatpost
I
Intezer
V2EX - 技术
V2EX - 技术
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
小众软件
小众软件
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
N
News | PayPal Newsroom
MyScale Blog
MyScale Blog
AI
AI
Vercel News
Vercel News
Spread Privacy
Spread Privacy
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
Help Net Security
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
L
LINUX DO - 热门话题
U
Unit 42
L
LangChain Blog
Recent Announcements
Recent Announcements

博客园 - Ratooner

.NET7 IOC注册SqlSugar .NET 7.0 Program.cs访问appsettings.json配置文件 vite学习笔记 vue3 el-image图片资源的使用 bootstrap.bundle.min.js bootstrap.bundle.min.js.map 404报错 js中===和==的区别 json-server 笔记 vue3创建项目笔记 openstack heat 实验笔记 openstack neutron 实验笔记 openstack nova 实验笔记 openstack glance 实验笔记 openstack keystone 实验笔记 Vue 中npm run dev 和 npm run serve 的区别 vue 学习笔记1 vue export学习笔记1 GRE和VXLAN的区别 openstack各组件逻辑关系图(转载) openstack创建云主机流程图(转载)
Flask+Vue 使用
Ratooner · 2023-03-24 · via 博客园 - Ratooner

Vue 项目经过npm run build 打包后生成文件在dist目录如下:

 app.py:

from flask import Flask, render_template

# 设置静态文件夹目录 static_folder='./dist'

# 设置vue编译输出目录dist文件夹,为Flask模板文件目录,template_folder='./dist'
app = Flask(__name__, static_folder='./dist', template_folder='./dist')

@app.route('/')

def index():
return render_template('index1.html')

if __name__ == '__main__':
app.run(debug=True)

index1.html:

<!doctype html>
<html lang="">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link rel="icon" href="./dist/favicon.ico">
    <title>test1</title>
      <script defer="defer" src="./dist/js/chunk-vendors.9d61cd2a.js"></script>
    <script defer="defer" src="./dist/js/app.1ba132cd.js"></script>
    <link href="./dist/css/app.2cf79ad6.css" rel="stylesheet ">
  </head>
  <body>
    <noscript><strong>We're sorry but test1 doesn't work properly without JavaScript enabled. Please enable it to
        continue.</strong></noscript>
    <div id="app"></div>
  </body>
</html>