0

私は自分の構成ファイルローダーでDjangoを使用しており、Pythonに組み込まれているConfigParserを継承し、get()メソッドを使用しています。

それはこのようなことをします:

from ConfigParser import RawConfigParser
config = RawConfigParser()
config.read(os.path.dirname(__file__) + '/settings.ini') # read the settings file
MEDIA_URL = config.get('SETTINGS', 'media_url') # which is verified to contain '/images/'

# then I expect this to return True, but get false?

print MEDIA_URL.endswith('/')
print type(MEDIA_URL) # get's "str"

# however this returns True
MEDIA_URL = '/images/'
print MEDIA_URL.endswith('/')
print type(MEDIA_URL) # get's "str"

では、なぜ両方が文字列型でありながら、異なる値を返すのでしょうか。

djangoの設定が台無しになり、django.confでエラーが発生します。初期化行70!

手がかりはありますか?

4

0 に答える 0