Reputation: 77
I am following this tutorial https://medium.com/@ahmed.dys99/deploying-django-application-on-google-cloud-platform-8eca8f82e7f6 I have followed all steps successfully but when I get to the last part of using the command nohup sudo python3 manage.py runserver 0.0.0.0:80
I am getting the message nohup: ignoring input and appending output to 'nohup.out'
. What does this message mean and how can I get my site to run successfully via gpc? If my app is associated with a database do I need to configure that with gpc first?
Upvotes: 0
Views: 211
Reputation: 336
First of all this is not an error! And your server should be running fine(unless there is any error in your server side code).
Easy answer: It is not an error, your server is probably running and all the logs of your server is redirected(sent) to file named 'nohup.out'. Nohup has nothing to do with running server or python or django or gcp, its a unix command to keep the process running even if you close the terminal session. You can try running the server by removing the nohup command from beginning, your server should be up.
Verbose explanation: For nohup: Its a standard log type message send from nohup command stating that the output of the command will be stored in 'nohup.out' file, as output file is not specified.
I suggest you to try these variations to understand better -
sudo python3 manage.py runserver 0.0.0.0:80
This runs the server in the same terminal window. Works? (try it out yourself by either hitting localhost from this host/outside network as specified in article after step 4). Point to note here - All the logs of the server will be seen in your terminal screen.
Now, once you close this terminal or exits shell, a HUP signal is sent by the OS stating the processes should be Hanged Up since the terminal is exiting. In lame terms, your running process will stop!(which you don't want, since its server, I assume you want to keep it running)
To overcome this situation, nohup command comes to rescue asking OS to continue running the command even if the session is disconnected/terminal exits/shell exits.
nohup -> No HUP -> Do not send HUP signal for this command - (Just for understanding)
Now, try your original command, i.e., nohup sudo python3 manage.py runserver 0.0.0.0:80
Now, you will see the old message stating nohup: ignoring input and appending output to 'nohup.out'
, which I repeat is not an error message, just specifying that the output of the command will be stored in nohup.out file.
Points to notice here -
after the command, nohup will create a nohup.out file and all logs from the command will go into this file.
A small assignment to try
nohup python3 manage.py runserver 0.0.0.0.0:80 > logs.txt
Its an extremely useful command in day to day life of developer folks Read more here, here: https://www.computerhope.com/unix/unohup.htm
Upvotes: 5