我使用子流程从Django应用程序运行外部脚本,如下所示:
class ExecutePythonFileView(View):
def get(self, request):
# Execute script
script_path = os.path.join(settings.BASE_DIR, '/Code/zenet/zenet/workers/stats_scraper.py')
subprocess.call(['python', script_path])
# Return response
return HttpResponse("Executed!")
但是,我需要通过Django虚拟环境执行它,如何继续
你有两个选择
选项1:
选项2:
相关问题 更多 >
编程相关推荐