擅长:python、mysql、java
<p>你应该在你的设置.py文件,位于<code>TEMPLATE_DIRS</code>列表中。在</p>
<p>不管您是否这样做,您都应该使用<code>os.path</code>模块的函数动态生成绝对路径。在</p>
<pre><code>os.path.abspath(__file__)
</code></pre>
<p>将返回被调用文件的绝对路径。在</p>
^{pr2}$
<p>将返回<code>'some/Path'</code>中最后一个目录的路径</p>
<p>通过组合它们,你可以得到绝对路径,在不同的系统上保持精确,例如</p>
<pre><code>os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
</code></pre>
<p>将返回目录的绝对路径,该路径比包含当前文件的目录高一级。在</p>
<p>去阅读<code>os.path</code>模块的<a href="http://docs.python.org/2/library/os.path.html" rel="nofollow">docs</a>。您可能还需要使用<code>os.path.join</code>。在</p>