Question

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?

Était-ce utile?

La solution

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.

Autres conseils

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 ;-)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top