如何在Visual Studio PTVS中运行命令? [英] How to run commands from within Visual Studio PTVS?

查看:150
本文介绍了如何在Visual Studio PTVS中运行命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2012和PTVS来处理蝗虫和肥皂水.

I'm using Visual Studio 2012 and PTVS to play around with locustio and suds.

我已经在Visual Studio中使用virtualenv设置了一个环境,并安装了locustio,suds和所有相关的依赖项.

I have setup an environment using virtualenv in Visual Studio and installed locustio, suds and all the associated dependencies.

如果要在Mac或Linux中通过命令行运行蝗虫,我会执行以下操作:

If I was to run locust via the command line in Mac or Linux I'd do something like:

locust -f theFileToRun.py'

`locust -f theFileToRun.py'

蝗虫将运行并打开一个本地托管的页面,在那里我可以控制蝗虫.

and locust would run and open a locally hosted page where I could control locust.

Django具有类似的设置,您可以从命令行输入runserver,并且django项目在本地托管.

Django has a similar setup where you type runserver from the command line and your django project is locally hosted.

我注意到PTVS在启动模式下列出了一个"Django启动器",我认为可以解决这个问题.

I've noticed that PTVS has a 'Django Launcher' listed under Launch Mode, which I assume takes care of this.

如何(巧妙地!)从Visual Studio中运行蝗虫或其他CLI命令?

How can I (neatly!) run locust or other CLI commands from within Visual Studio?

推荐答案

现在,Django是我们特别支持的唯一Python Web框架,是的,这包括为您启动服务器(以及打开浏览器)并导航到本地网站.

Right now, Django is the only Python web framework which we have special support for, and yes, this includes starting the server for you (and also opening the browser and navigating to the local website).

对于其他所有内容,您暂时需要使用常规控制台. 此VS扩展名可能对您有所帮助.

For everything else, you'll need to use the regular console for the time being. This VS extension might be of help there.

鉴于在开发Python代码时,在项目根目录中运行各种shell命令并不是一件罕见的事情,而且我们不能对所有众多框架进行特殊情况处理,实际上这听起来像是我们要考虑的有趣功能.我认为目前我们不在问题跟踪器中,因此请继续添加到此处.

Given that running various shell commands in project root is not an uncommon activity when developing Python code, and that we can't special-case all the numerous frameworks out there, it does actually sound like an interesting feature for us to consider. I believe we don't have it in the issue tracker in the moment, so go ahead and add it there.

这篇关于如何在Visual Studio PTVS中运行命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆