0
我現在的項目是這樣的:爲什麼網址無法使用後的藍圖中產生
├── __init__.py
├── pages
├── settings.py
├── static
├── templates
│ ├── article.html
│ ├── base.html
│ ├── index.html
│ └── posts.html
├── view
│ ├── article.py
│ ├── home.py
│ ├── index.py
│ └── postwall.py
我breaked views.py(不再在項目中)到文件,這些文件無法生成URL動態了。我曾在article.py是:
from flask import Blueprint, render_template
from app import articles
article = Blueprint('article',__name__)
@article.route('/article/<path:path>/')
def page(path):
article = articles.get_or_404(path)
return render_template('article.html',page=article)
同時,posts.html它提供的鏈接按鈕,文章不工作了:
<a href="{{ url_for('page', path=page.path) }}">More -></a>
問題是什麼我錯過了什麼?在藍圖文件中?