i relatively new python/django , have deployed first app. want update new changes, not sure proper process is. setup ubuntu/nginx/gunicorn/postgres.
at moment taking following steps:
- stop nginx: sudo service nginx stop
- stop gunicorn: sudo service gunicorn stop
- backup db? (not implemented - cant find on server)
- git pull
- python manage.py migrate
- python manage.py collectstatic
- restart gunicorn: sudo service gunicorn start
- restart nginx: sudo service nginx restart
this working, appreciate guidance if complete, accurate , safest way please?
one lazy (yet recommended and professional) way of going app updates running automation script, fabric or ansible.
however, if wish proceed manual way (which tedious), might like:
- pull git
- run migrations
python manage.py migrate(this should ensure changes made locally models reflect in production db) - run static collections ensure new statics reflected in server /static/ folder so:
python manage.py collectstatic - then, restart django server not nginx. like:
sudo service your_django_server_running_instance restart
on digitalocean instance (when used one-click install), django server running instance called gunicorn
then might want automating postgresql db well
Comments
Post a Comment