在Linux / Ubuntu机器上从Python / Django设置网络设置 [英] Setting Network settings from Python/Django on a Linux/Ubuntu machine

查看:390
本文介绍了在Linux / Ubuntu机器上从Python / Django设置网络设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为嵌入式计算机开发一个简单的Web界面。计算机将附带一个静态默认的ip,然后需要由安装技术更新,可能不是tech / linux的精明。



基本上,我需要从Django应用程序更改以下系统设置。


  1. IP地址

  2. 子网

  3. 默认网关

  4. DNS服务器1& 2

我意识到我可以覆盖linux中的配置文件,但我想知道是否有更多的Python方式。

解决方案

看看Github上的pynetlinux:



https://github.com/rlisagor/pynetlinux



这是一个很好的起点,您可以很容易地添加剩余的功能,我想象。


I'm working on a simple web interface for an embedded computer. The computer will ship with a static default ip that will then need to be updated by the install tech who may not be tech/linux savvy.

Basicly I need to change the following system settings from a Django app.

  1. IP Addres
  2. Subnet
  3. Default Gateway
  4. DNS Servers 1&2

I realize that I can could just overwrite the config files in linux but I was wondering if there is a more "Python" way of doing it.

解决方案

Have a look at pynetlinux on Github:

https://github.com/rlisagor/pynetlinux

It is a good starting point and you can add the remaining functionality yourself quite easily I would imagine.

这篇关于在Linux / Ubuntu机器上从Python / Django设置网络设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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