私はしばらくの間、テンプレートをいじっていましたが、django の経験のすべての瞬間が大好きです。ただし、django は疎結合の大ファンであるため、次のコードを使用しない理由を知りたいと思いました。
import os
import platform
if platform.system() == 'Windows':
templateFiles = os.path.join(os.path.dirname(__file__), '..', 'templates').replace('\\','/')
else:
templateFiles = os.path.join(os.path.dirname(__file__), '..', 'templates')
TEMPLATE_DIRS = (
# This includes the templates folder
templateFiles,
)
それ以外の:
import os
TEMPLATE_DIRS = (
templateFiles = os.path.join(os.path.dirname(__file__), '..', 'templates').replace('\\','/')
)
最初の例は 2 番目の例よりも疎結合の哲学に従っているのではないでしょうか (私はそうなっていると思います)。