如何独立运行 django脚本(需要settings时)_贪婪的小猪_百度空间

如何独立运行 django脚本(需要settings时)_贪婪的小猪_百度空间

如何独立运行 django脚本(需要settings时)
2010-01-21 14:41
http://www.b-list.org/weblog/2007/sep/22/standalone-django-scripts/





from django.core.management import setup_environ

from register import settings



setup_environ(settings)





from django.contrib.sites.models import Site

domain = Site.objects.get_current().domain

print domain
原文地址:https://www.cnblogs.com/lexus/p/2435607.html