标签:
复制manage.py中的相关代码即可并将文件置于Project文件夹(与manage.py同位置)下
示例:
#! /usr/bin/env python # -*- coding:utf-8 -*- import os if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") #your codes from django.contrib.auth.models import User try: u = User(username = ‘admin‘, password = ‘admin‘) u.set_password(u.password) u.save() except: print ‘Error‘
标签:
原文地址:http://www.cnblogs.com/flowjacky/p/4454149.html