Restart django on linux - django

Ive deployed a django app on linux using nginx, supervisor and gunicorn.
I have made updates (using GIT and manually in settings.py). The files changed but the application has not changed (i.e. it still functions the same as before the changes were added).
I've tried lots of commands but none of them work e.g.
//reload/restart nginx
sudo service nginx restart
sudo systemctl reload nginx
sudo systemctl restart nginx
//reload supervisor
sudo supervisorctl reload
//restart gunicorn (supervisor)
sudo supervisorctl restart gunicorn
//reboot ubuntu using systemctl
sudo systemctl reboot
//reboot ubuntu
sudo reboot now
//force reboot ubuntu
sudo reboot -f
Any help is greatly appreciated.

Related

AWS User data script Docker-Run not working

I have installed docker and httpd on an instance and when I run
sudo docker run -d -p 8600:8080 pengbai/docker-supermario
in SSH, The command works but when I Restart the Instance with this user data(docker and httpd already installed)
#!/bin/bash
sudo yum update -y
sudo systemctl enable httpd
sudo systemctl start httpd
sudo systemctl enable docker
sudo systemctl start docker
sudo docker run -d -p 8600:8080 pengbai/docker-supermario
It does not work
I have tried it with sudo, without sudo and even added a sleep command between some of the commands but still couldn't get it to work.

Why new pulled code from git not applied when Gunicorn running on ubuntu server?

I have a django project on ubuntu server that works with Nginx and Gunicorn correctrly.
I change some django code and push on git server and then pull from git server on ubuntu server. It seems new changes not implemented on server. How to fix it?
I restart and reload Gunicorn and Nginx but not happend.
I found the answer we can enter command like this for restarting Gunicorn:
sudo systemctl daemon-reload
sudo systemctl restart gunicorn

How to Deploy Multiple Django Apps on Single server using Ngnix & GUnicorn?

I am trying to Deploy Two Django apps with single AWS EC2 Instance having same IP.
But it always failed when I have added the second App.sock and test Supervisor.
I fond some body asked similar question before. but Not answered properly, and my use case is little different. ( Run multiple django project with nginx and gunicorn )
I have followed these steps:
.
Cloned my project from Git *
pip install -r requiernments.txt
pip3 install gunicorn
sudo apt-get install nginx -y
sudo apt-get install supervisor -y
cd /etc/supervisor/conf.d
sudo touch testapp2.conf
sudo nano testapp2.conf
Updated config file same as below
[program:gunicorn]
directory=/home/ubuntu/projects/testapp2/testerapp
command=/home/ubuntu/projects/testapp2/venv/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/projects/testapp2/testerapp/app.sock testerapp.wsgi:application
autostart=true
autorestart=true
stderr_logfile=/home/ubuntu/projects/testapp2/log/gunicorn.err.log
stdout_logfile=/home/ubuntu/projects/testapp2/log/gunicorn.out.log
[group:guni]
programs:gunicorn
*----------
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl status
The below steps will work and Site available on browser if there is only One configuration above. But when i have added an additional configuration, it shows 502 Bad Gateway on the Browser. Please help me to solve this issue.
You can add one more config file in supervisor conf.d and use different port numbers in the different Django apps.

Django changed files not synchronizing changes on ubuntu nginx gunicorn

My django project working fine which is deployed on ubuntu server with nginx, Gunicorn. But when I make changes in Template files, Views, Forms, Models and upload using Filezilla, No changes synchronize/ Or project is not showing made changes by me.
Can scholars and seniors help in this please.
I think this will help if you are using gunicorn sock file
sudo systemctl daemon-reload
sudo systemctl restart gunicorn
sudo nginx -t && sudo systemctl restart nginx
you can read from here

Website with Django 3 and django_plotly_dash does not update website

I have a website that contains a dashboard that is based on plotly-dash. I want to change it and I can see the changes when running ./manage.py runserver, but not when serving is with nginx. I did
./manage.py collectstatic
Also deleted all .pyc files and __pycache__ and restarted supervisor and nginx with :
sudo supervisorctl stop all && sudo supervisorctl reread && sudo supervisorctl update && sudo supervisorctl start all && sudo service nginx restart
Which runs through. What did I miss?
I had to kill some processes myself using sudo killall python. It seems sometimes supervisor forgets to kill some processes.