发布时间:2022-08-09 文章分类:编程知识 投稿人:赵颖 字号: 默认 | | 超大 打印
如何独立运行 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