質問

プロファイルしたい電子メールと呼ばれるアプリに関数があります。私がこのようなことをしようとするとき、それは爆発します

   from django.core.management import BaseCommand
   import cProfile


  class Command(BaseCommand):
       def handle(self, *args, **options):
           from email.modname import send_email
           cProfile.run('send_email(user_id=1, city_id=4)')

この管理コマンドを実行すると、次のエラーがスローされます。

      exec cmd in globals, locals
     File "<string>", line 1, in <module>
     NameError: name 'send_email' is not defined

ここに何が欠けていますか? CPROFILEは文字列をどのように評価しますか(グローバル/ローカルネームスペースでFUNC名を調べます)?

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top