문제

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.

다른 팁

Run PyCharm from Terminal like so:

sudo /Applications/PyCharm.app/Contents/MacOS/pycharm

You need to launch the binary as sudo. This will allow PyCharm to run the dev server as root on port 80.

replace 0.0.0.0 with localhost ;-)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top