Python 德扬戈壳牌公司<;file.py导入功能
我正在通过哨兵命令尝试:Python 德扬戈壳牌公司<;file.py导入功能,python,django,sentry,Python,Django,Sentry,我正在通过哨兵命令尝试: sentry --config=sentry.conf.py shell < add_user.py authfile是一组字典,用于填充for循环中调用的值 如果我运行交互式shell并导入此文件,它就会工作。如果我试图通过介绍和概述IPython的功能来了解它。 %快速参考->快速参考。 帮助->Python自己的帮助系统。 对象?->有关“对象”的详细信息,请使用“对象??”获取更多详细信息。 在[1]中: 在[2]中: 在[2]中: 在[3]中: 在[3
sentry --config=sentry.conf.py shell < add_user.py
authfile是一组字典,用于填充for循环中调用的值
如果我运行交互式shell并导入此文件,它就会工作。如果我试图通过介绍和概述IPython的功能来了解它。
%快速参考->快速参考。
帮助->Python自己的帮助系统。
对象?->有关“对象”的详细信息,请使用“对象??”获取更多详细信息。
在[1]中:
在[2]中:
在[2]中:
在[3]中:
在[3]:…::…:…:…:…:
在[4]:…:…:…:…:…:…:…:…:…:…:
是否确实要退出([y]/n)?
1。在一个普通的外壳中尝试,而不是ipython,2。您可能应该将其设置为自定义管理命令。卸载ipython会减少输出,但结果相同<代码>sentry--config=../sentry.conf.py shell
from django.contrib.auth.models import User
try:
import authfile
except Exception as e:
print "authfile not present, %s" % e
def conv_dict(the_dict):
sen_username = the_dict['sen_username']
sen_email = the_dict['sen_email']
sen_password = the_dict['sen_password']
print sen_username
return sen_username, sen_email, sen_password
for t, imp_dict in authfile.__dict__.iteritems():
if isinstance(imp_dict, dict) and not t.startswith('_'):
sen_username, sen_email, sen_password = conv_dict(imp_dict)
try:
new_user = User.objects.create_user( sen_username, sen_email, sen_password)
new_user.is_superuser = True
print "created new user: %s" % imp_dict['sen_username']
except Exception as e:
print "could not create new user: %s" % e
pass
sentry --config=../sentry.conf.py shell < add_super.py
Python 2.7.3 (default, Aug 9 2012, 17:23:57)
Type "copyright", "credits" or "license" for more information.
IPython 1.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]:
In [2]:
In [2]:
In [3]:
In [3]: ...: ...: ...: ...: ...: ...:
In [4]: ...: ...: ...: ...: ...: ...: ...: ...: ...: ...:
Do you really want to exit ([y]/n)?