例えば、URL:http://127.0.0.1:8000/api/tests/ にアクセスした際に「batch.py」を実行したいです。
view.py
from simulation.management.commands import batch class TestViewSet(viewsets.ModelViewSet): batch.main()
urls.py
from simulation.management.commands import batch router.register(r'tests', TestViewSet, batch.main())
など試しましたが、runserver立ち上げ時した実行されませんでした。
batch.pyは
アプリケーション名/management/commands/
に格納されています。
よろしくお願いします。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/02/12 01:09