在结构文件中使用Django设置

pau*_*ins 8 django fabric

我想在我的Django设置文件中迭代INSTALLED_APPS,如下所示:

@task
def test_app
    print settings.INSTALLED_APPS
Run Code Online (Sandbox Code Playgroud)

如何在fabfile中访问我的设置文件?

谢谢.

ari*_*rie 15

它记录在案:http://docs.fabfile.org/en/latest/api/contrib/django.html

from fabric.contrib import django

django.settings_module('myproject.settings')
from django.conf import settings
Run Code Online (Sandbox Code Playgroud)