Pycharm:以root权限运行服务器 [英] Pycharm: run server with root permission
问题描述
我需要在端口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屋!