I've changed env file and models.py for media app. When i check the files, the code shows the latest version, which is correct. When i visit the page, i don't see any changes. On my local environment i see the changes.
I've done the following
sudo systemctl restart nginx
sudo systemctl restart uwsgi
then i tried touch on uwsgi/admin.ini
touch admin.ini
sudo systemctl restart uwsgi
then i deleted __pycache__
I restarted the instance and the changes aren't showing?
I checked the env file and still using old credentials.
There are no errors in the logs? How can i debug this?
Related
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
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
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.
I am trying to deploy a django website on an aws ec2 instance (ubuntu 18.04) following this tutorial that is consistent with other online resources. Everything is working fine but there is some issue with gunicorn. The worker doesn't seem to boot.
I figured there was something wrong with my installation and I tried uninstalling and installing with different commands-
inisde my virtualenv with
pip install gunicorn
and
sudo -H pip install gunicorn
I even physically deleted all gunicorn files and reinstalled gunicorn but its always the same. Where have I gone wrong?
p.s: I had initially done sudo apt-get
From the screenshot you attached, it seems that gunicorn is installed correctly, but perhaps you have not passed a configuration file. The command to run gunicorn with a configuration is
gunicorn -c /path/to/gunicorn.conf.py myapp.wsgi:application
I had started a fresh linode running ubuntu 19.04 and the first time I used the directions at:
https://www.rosehosting.com/blog/how-to-install-mezzanine-cms-on-ubuntu-18-04/
To install Mezzanine CMS it worked just fine, I could run the runserver command and see the django website. Eventually it started giving me a problem after trying 50 ways to deploy the site using apache and mod_wsgi.
I gave up and rebuilt the server and then still couldn't see the new install at the IP when I ran run server. I figured maybe it was because I accidentally installed some things using "python" and others with "python3" so I rebuilt the server.
This third time I followed the direction perfectly, the only difference is I didn't install a mysql server just kept the default SQLlite server and created a DB and Django Superuser.
I have added my ip as a host in settings.py and local_settings.py
I have already ran makemigrations and migrate
I did check to see if maybe the IP had changed when I rebuilt, it hadn't
My local environment on my laptop works fine, just not the linode
Any suggestions on anything I'm missing?
Deployment Guide
Step 1 (Installation)
Install apache2 mod_wsgi
Install virtualenv
Install virtualenv
Install Nginx for asynchronous event-driven approach to handle multiple client requests
Install mysql
sudo apt-get update
sudo apt-get install python3-pip python3-dev apache2 libapache2-mod-wsgi-py3
sudo apt-get install virtualenv ufw
sudo apt-get install nginx
sudo apt-get install mysql-server libmysqlclient-dev
sudo mysql_secure_installation
Step 2 (Apache & Hostname & User)
Set hostname and add it into /etc/hosts with hostname and your Server IP
Create new user and give add to the group sudo for safety
sudo adduser username
sudo usermod -aG sudo
Enable SSH authentication for login & Edit default port of ssh in /etc/ssh/sshd_config. https://askubuntu.com/questions/1074034/not-able-to-change-ssh-port-on-ubuntu-18-04-1-lts
Edit /etc/apache2/site-availabledefault-000.conf for your new Django configuration
Step 3 (Firewall)
sudo ufw allow 8000
sudo ufw allow http
sudo ufw allow ssh
sudo ufw default allow outgoing
sudo ufw default deny incoming
Enable all other required port numbers
ssh sudo ufw enable
Step 4 (Django configuration)
Chown static and media forlders and edit it's permission recursively
Add allowed host in settings.py
Checkout deployment checklist in django official website and do it.
Step 5 (Please checkout)
For apache configuration please visit https://pythonprogramming.net/deploying-to-server-django-tutorial/
Edit the path given in your apache configuration (path for WSGI Script,python-path, python-home ) if any errors found like Internal server error, miss configuration etc
For reference of python-home path please refer Get virtualenv's bin folder path from script
You can also add python-path to WSGIDaemonProcess
Additionally, you can visit puttygen for public and private key generation to login through SSH
For this particular problem turned out I just needed to suddenly bind dev server to 0.0.0.0
the command to do so was
python manage.py runserver 0.0.0.0:8000
Rinshans answers is definetley the details for deployment, I've followed those steps just kept making some mistake in the config and wsgi scripts. I'm going to try deploying with Gunicorn or use the Fabric self-deployment tools built in to Mezzanine CMS, just haven't done so yet.