Django Book 翻译
菜单>:
TOC
返回
原文:
Youll notice this starts a Python interactive interpreter. Looks can be deceiving, though! Theres an important difference between running the command ``python manage.py shell`` within your Django project directory and the more generic ``python`` . The latter is the basic Python shell, but the former tells Django which settings file to use before it starts the shell. This is a key requirement for doing database queries: Django needs to know which settings file to use in order to get your database connection information.
翻译:
你会看到该命令启动了一个 Python 交互界面。运行命令 ``python manage.py shell`` 启动的交互界面和标准的 ``python`` 交互界面有很大的区别。看起来都是基本的python外壳(shell),但是前者告诉Django使用哪个配置文件启动。这对数据库操作来说很关键:Django需要知道使用哪个配置文件来获得数据库连接信息。
备注:
译者: