Ask coding questions

← Back to all posts
Second Console or Shell?
StingChameleon (2)

Is it possible to add extra console or shell windows? I already have one of each, but I need more.

Answered by Coder100 (18238) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (18238)

Maybe

<process1> & <process2>

so like, in your .replit file:

run = "run-redis-server & do-my-server & whatever"
StingChameleon (2)

I think this is going to work! I'll have to finish enough of the chapter to test it out, but it seems to be running the server before launching my app while not using my shell window at all! @Coder100

CodeMaster007 (108)

No. The best way to approach adding a extra console is by making a new repl or forking your other code. Thanks

StingChameleon (2)

In that case, let me ask another question:
I'm trying to launch a Redis server, which I am fully capable of doing. I also need to start an RQ worker, which seems to require a shell, which is already being used by the Redis server. My concern, then, is how will my worker process access the Redis server from a second repl.it? What do I need to do to make this work? @CodeMaster007

CodeMaster007 (108)

After researching a bit I found that you can use threading, asynchronous programming, or multiple processes. I'm not really sure what you want to do but basically, you want to run 2 programs in the same file? @StingChameleon

StingChameleon (2)

To be as specific as possible, I'm going through the Background Jobs chapter of the Flask Mega Tutorial. This chapter involves running a Redis server, running a Reddis Queue (RQ) worker that connects to the Redis server, and the python web app itself. Both the Redis server and the RQ worker are run from the shell and they both consume the entire shell, so I need two separate shells if I want to run both of them. The web app will run just fine from the console, since it's just a python application.

@CodeMaster007

CodeMaster007 (108)

Hey! I looked into this and tried to figure out what is going on. I also imported the github file into repl and did some code changes. You can look through the program below and check if this is what your looking for. Thanks! @StingChameleon

https://replit.com/@CodeMaster007/microblog

StingChameleon (2)

I certainly appreciate the effort, but I can't even get this one to run. I tried running it from your link and forking it. I pip installed from the requirements. The run button seems to do nothing. Even using flask run --host=0.0.0.0 canceled itself out the first few times and the final time I ran it the site functionality wasn't working properly enough for me to get to the point where I could test out the background jobs. I didn't see anything in there that would serve to launch the Redis server or the RQ worker process.

@CodeMaster007