Python setup.py不是';t更新烧瓶模板/index.html
我在setup.py安装一个简单的Flask应用程序并创建一个入口点来运行该应用程序时遇到问题。以下是我的目录结构:Python setup.py不是';t更新烧瓶模板/index.html,python,flask,setup.py,Python,Flask,Setup.py,我在setup.py安装一个简单的Flask应用程序并创建一个入口点来运行该应用程序时遇到问题。以下是我的目录结构: <root folder> `-- example `-- __init__.py `-- 01 `-- __init__.py `-- app.py `-- templates `-- index.html 这是我的模板/index.html <
<root folder>
`-- example
`-- __init__.py
`-- 01
`-- __init__.py
`-- app.py
`-- templates
`-- index.html
这是我的模板/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Your First Web Server</title>
</head>
<body>
<h1>Current time: {{now}}</h1>
</body>
</html>
这是我的MANIFEST.in文件:
include README.md
recursive-include example/01/templates *
global-exclude *.pyc
问题出在这里。如果我运行python setup.py install
,然后运行export FLASK\u APP=examples/01/APP
,然后运行FLASK run
,则应用程序将正确运行,并且每次刷新页面时,我都会在浏览器上获得预期的当前时间戳
但是,如果我运行
example_02
(控制台脚本入口点),服务器将运行,但是如果我导航到页面,我将从01/templates/index.html
文件的旧版本中获取内容。对我来说,真正奇怪的部分似乎是我没有做任何改变,我似乎无法让python setup.py install
将控制台脚本入口点更新到新的index.html文件。我在处理python setup.py
时注意到的一件事是旧的*.pyc文件。我用它来清理它们并尝试重新构建,以便生成最新的内容。你已经讨论过这个场景了吗?我想我可能已经尝试过各种各样的事情了。我已经删除了我的虚拟环境,完成了python setup.py clean--all
,删除了与我的项目相关的build、dist和各种*.egg文件。不过,所有这些都表明我没有明确删除*.pyc文件,我会深入研究,谢谢!
from setuptools import setup, find_packages
setup(
name="example",
packages=find_packages(),
include_package_data=True,
install_requires=[
"flask==1.1.2"
],
entry_points={
"console_scripts": [
"example_01 = examples.01.app:main",
]
}
)
include README.md
recursive-include example/01/templates *
global-exclude *.pyc