Reputation: 24966
I'm running into something confusing with Flask 10.1.
from flask import Flask
app = Flask(__name__)
app.config.from_pyfile('local.cfg')
app.config.update(dict(
BAR = 'bar',
))
where local.cfg is
FOO = 'foo'
BAR = 'bar'
I get
app.config['FOO'] => ('foo',)
app.config['BAR'] => 'bar'
Am I doing something wrong that's turning FOO into a tuple?
Upvotes: 2
Views: 1773
Reputation: 24966
Well, that was embarrassing. I was suffering a case of comma blindness. For the benefit of anyone else who stumbles into this problem, having a stray comma in a configuration file causes tuples. That is,
FOO = 'foo'
works as expected. But type
FOO = 'foo',
and things go sideways, since app.config['FOO'] == ('foo',)
Upvotes: 7