Change port for localhost

general
octopi

#1

What is the problem?
Hi !
I would like to control two printers 3D with octoprint on windows 10. If i understand correctly, it is not possible to do that if I use the same port on windows (I must be on Rapsberry Pi).
That's why I would like to open an another local host at port 5001 for example.

What did you already try to solve it?
I tried the command "octoprint serve --basedir "%APPDATA%\OctoPrint2" --port 5001" and I had the message "'octoprint' is not recognized as an internal or external command, operable program or batch file."
I don't know how create an another localhost connection.

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)
Octoprint 1.3.6; Windows10; Scara Arm 3D Printer; localhost:5000;


#2

Then you didn't have the virtual environment activated yet into which you installed OctoPrint. Additionally you'll probably have to replace %APPDATA% in your --basedir parameter with the expanded version (usually C:\Users\YourUsername\AppData\Roaming), I'm not sure if your command line will expand it for you here.

To change the port you can either supply it via --port as you did, or modify config.yaml of your second instance and set server.port to your desired alternative port number.


#3

Hi !
Thank you for your answer :slight_smile:
I'm trying in a virtual environment and I hav this error:

If it worked, it allows me to launch another connection with another port, right ?


#4

I'm not sure what you are trying to do there, since what you typed in there would be the command to create a new virtual environment and not to activate an existing one.

So let's get some basics out of the way first.

Did you setup OctoPrint following this guide? (That guide was still located on the Github wiki until a couple hours ago)

https://discourse.octoprint.org/t/setting-up-octoprint-on-windows/383

Or did you do it in some other way? If so, please explain what you did first. No one but you is sitting in front of your PC and knows what you did there, you have to tell us :wink:

If you did follow that guide, you can activate the virtual environment by doing this:

cd C:\OctoPrint
venv\Scripts\activate.bat

After that you can start OctoPrint by just calling octoprint from that very same command line.

But instead of fiddling around with command lines here it would probably be easier if you just created a second shortcut with your parameters.


#5

I'm do this tutorial indeed.
image
My environment is created thank you !

Now I must write this command:
octoprint serve --basedir "%APPDATA%\OctoPrint2" --port 5001 and it's working thank you so much !

Now I would like to create a shortcut .exe to launch octoprint at port 5001 How can I do please ?
I don't understand what I must modify :confused:


#6

My issue is resolved ! :slight_smile:
Thank you so much for your fast answers !


#7

Could you please mark the solution then so that others may find it easily?


#8

Yes !

To solve my issue I do this:

  • activate the virtual environment with:
    cd C:\OctoPrint
    venv\Scripts\activate.bat
  • launch a server with:
    octoprint serve --basedir "%APPDATA%\OctoPrint2" --port 5001

To create a shortcut, right click on the desktop; create a shortcut and the way is:
C:\OctoPrint\venv\Scripts\octoprint.exe serve --port 5001

With the number for the desired port :slight_smile: