如何独立运行 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

发表回复