复制manage.py中的相关代码即可并将文件置于Project文件夹(与manage.py同位置)下
示例:
#! /usr/bin/env python# -*- coding:utf-8 -*-import osif __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'