Pycharm:以root权限运行服务器 [英] Pycharm: run server with root permission

查看:387
本文介绍了Pycharm:以root权限运行服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以使用root权限在Pycharm中运行django-server吗?
我需要在端口80启动服务器(在调试模式下)
我设置主机为0.0.0.0和端口为80,但如果我尝试从Pycharm启动它,我得到这个错误:

 错误:您没有访问该端口的权限。 

我还尝试运行这个自定义命令:

  sudo runserver 0.0.0.0:80 

但它失败。我使用macOsX Lion,任何建议?

解决方案

您可以以root身份运行PyCharm,其子进程将继承root权限或者您可以使用端口> = 1024。



如果要在非特权端口上运行时运行它在端口80上可访问,请考虑设置一些反向代理端口80,将流量重定向到Django端口= 1024,以便它可以无root运行。



我建议使用 nginx 作为前端。



另外检查此问题


Can I run django-server in Pycharm with root permission? I need to start the server (in debug mode) at the port 80. I set host to 0.0.0.0 and port to 80 but if when I try to start it from Pycharm I get this error:

Error: You don't have permission to access that port.

I also tried to run this custom command:

sudo runserver 0.0.0.0:80

but it fails. I use macOsX Lion, any suggestions?

解决方案

You can either run PyCharm as root itself and its child processes will inherit the root permission or you can use port >= 1024.

If you want to run it to be accessible on port 80 while running on the unprivileged port, consider setting up some reverse proxy on port 80 that will redirect traffic to Django port >= 1024 so that it can run without root.

I'd recommend using nginx as a front-end.

Also check this question.

这篇关于Pycharm:以root权限运行服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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