开发者

How to access putty using Django

开发者 https://www.devze.com 2023-03-21 08:00 出处:网络
I am new to Django and i was wondering if i can do some backend testing using Django. I have already installed Django in windows. My work usually deals with putty(e.g. opening files, checking some dat

I am new to Django and i was wondering if i can do some backend testing using Django. I have already installed Django in windows. My work usually deals with putty(e.g. opening files, checking some data in a file, but this all is done in a putty box). 开发者_JS百科So i was hoping if somehow i can take all the work from backend to front end by accessing putty from django(e.g creating a link to start a putty session, logging in and performing some operations). Please help me in providing the information if this can be done and if its possible, how to do it.

Thanks in advance,


For a start, you need to learn the difference between putty (a Windows application that emulates a remote terminal) and ssh, a protocol for logging into remote systems. So, if you want to do something remotely via Python, you should be thinking about how to start an SSH session, rather than how to automate putty particularly. You might, for example, look into the paramiko library, which does just that.

Secondly, as the other answerers have mentioned, this seems an odd requirement. Web frameworks are not ideally suited to doing things like this. If you just want to automate some remote operations, perhaps fabric is what you need.


Since putty is a different application you need to spawn a subprocess and communicate with the application through stdin and stdout. This can be done using the subprocess module.

But please remenber, that Django is a web framework. This means it is for creating web application. Your problem looks more like a general "I want to automate something" problem where you don't need a web framework - you can simply use pure python. Is there any reason why you are using Django?

0

精彩评论

暂无评论...
验证码 换一张
取 消