我发现 Flask Babel 和 Jinja 之间的文档令人困惑。
ubuntu@ubuntu-VirtualBox:~/workspace/rtbopsConfig/rtbDashboard3$ python run.py
Traceback (most recent call last):
File "run.py", line 11, in <module>
from app import app
File "/home/ubuntu/workspace/rtbopsConfig/rtbDashboard3/app/__init__.py", line 14, in <module>
app.config.from_pyfile('babel.cfg')
File "/usr/local/lib/python2.7/dist-packages/flask/config.py", line 129, in from_pyfile
execfile(filename, d.__dict__)
File "/home/ubuntu/workspace/rtbopsConfig/rtbDashboard3/app/babel.cfg", line 1
[jinja2: **/templates/**.html]
^
SyntaxError: invalid syntax
这是每个文档。
[python: **.py]
[jinja2: **/templates/**.html]
extensions=jinja2.ext.autoescape,jinja2.ext.with_
这是我的__init__.py
文件
import os
from flask import Flask
from flaskext.babel import Babel
from config import basedir
app = Flask(__name__)
app.config.from_object('config')
app.config.from_pyfile('babel.cfg')
babel = Babel(app)
现在这让我无处可去。我该如何解决?