Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With mkdocs serve switch to another port if the current port is busy #3496

Open
fralau opened this issue Dec 2, 2023 · 0 comments · May be fixed by #3498
Open

With mkdocs serve switch to another port if the current port is busy #3496

fralau opened this issue Dec 2, 2023 · 0 comments · May be fixed by #3498

Comments

@fralau
Copy link

fralau commented Dec 2, 2023

It is possible that a couple of instances of the MkDocs web server are running at the same time, for legitimate reasons. The second time, the server won't start, unless a different port is used. The solution is to use the -a/--dev-addr option with mkdocs-server, but it is tedious.

Programmatically checking that the port is free is easy, and this could be automated (rather than failing).

Additional points

  1. For the port numbers, a simple approach would be to increment the port from 8000 up, let's say on a range from 8000 to 8019 (I do not see why one would want to open more than a couple; it would rapidly become difficult for the user to keep up with their own mind pointers/terminal sessions).
  2. Needless to say, a server that self-updates (after detecting a file change) should keep the same port.

See also discussion in #3494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants