美文网首页
python运行环境配置Django

python运行环境配置Django

作者: 感雨韵 | 来源:发表于2018-07-24 16:56 被阅读0次

    主要是这三句:

    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "magsite.settings")
    import django
    django.setup()
    

    后面就可以导入Django中的数据类型,就像你运行了python manage.py shell后敲入的命令那样:

    from account.models import MagUser
    MagUser.objects.create_superuser(“yxu”, "123456")
    

    相关文章

      网友评论

          本文标题:python运行环境配置Django

          本文链接:https://www.haomeiwen.com/subject/rgoemftx.html