postgresql - Updating Django App on server -


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:

  1. stop nginx: sudo service nginx stop
  2. stop gunicorn: sudo service gunicorn stop
  3. backup db? (not implemented - cant find on server)
  4. git pull
  5. python manage.py migrate
  6. python manage.py collectstatic
  7. restart gunicorn: sudo service gunicorn start
  8. 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