1

I have Very Comman issue might looks easy.I have Pushed my Django project on Live Digital Ocean server.I have done all the Configuration using Putty terminal.My project is Working Fine but when i close my Terminal,Project stopped working.I am using Digital Ocean Server.my Question is How to Keep Project Running after closing terminal? i will be Thankful if anyone can Help me with this issue.

  • 2
    You don't say explicitly how you're starting your application, but i am going to assume that you are using the runserver management command. If so, you should look into using gunicorn or similar to serve the application in production. This is reasonably straightforward and is "best practice". Plus it will fix your issue! – PirateNinjas Oct 14 '20 at 10:20
  • 1
    https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-20-04 have a look here to set up your app with gunicorn, postgres, nginx . It is very well explained. – barbaart Oct 14 '20 at 10:37
  • Django's [Deploying Django guide](https://docs.djangoproject.com/en/3.0/howto/deployment/) is important to read before running your app on a publicly accessible server. – D Malan Oct 14 '20 at 13:05

3 Answers3

1

You can use nohup command to run a command or shell-script even after you logout.

nohup command
napuzba
  • 6,033
  • 3
  • 21
  • 32
1

If you're just testing your application in development and you don't want to set up a production server as @PirateNinjas and @barbaart have suggested you which is the most secure thing to do. Then you can try to run the runserver command in the builtin console that your digitalocean's droplet has. Take a look here https://www.digitalocean.com/docs/droplets/resources/console/. It'll open a console in a separate browser and after you run the runserver command you can close it. Good luck!

Fede Riva
  • 25
  • 6
-1

Im using Tmux - multisession terminal processor.

Timur U
  • 415
  • 2
  • 14