Commits

Luke Plant  committed 01875a8

Updates to README

  • Participants
  • Parent commits 3e2a499

Comments (0)

Files changed (2)

 - you are using Django 1.4 or greater
 
 - you have your development environment already setup, including
-  having 'fabric' installed. You also need 'psutils' installed,
-  and added to your requirements.txt for production.
+  having 'fabric' installed.
 
 - your server is basically 'provisioned' i.e.
 
 
 - use of a pip 'requirements.txt' for installation of Python packages, in the
   same directory as the fabfile. It should contain at least:
+
   * Django
   * south
   * gunicorn
-  * psutils
+  * psutil
+  * fabric
 
 - use of Mercurial for source control, requiring hg to be installed on
   your server. (This could be easily modified to use git).
 
 Use 'fab -l' to see other commands
 
+You should probably create a cronjob to ensure that the Gunicorn webserver is
+running. This can use fabric on the server and the command 'local_webserver_start':
 
+*/10     * * * *    /home/myuser/webapps/myapp_django/venv/bin/fab -f /home/myuser/webapps/myapp_django/src/fabfile.py local_webserver_start
 
 Tips
 ----
 
 import posixpath
 
-from fabric.api import run, local, abort, env, put, settings, cd, task
-from fabric.decorators import runs_once
+from fabric.api import run, local, abort, env, put, task
 from fabric.contrib.files import exists
 from fabric.context_managers import cd, lcd, settings, hide
 import psutil
     run(_webserver_command())
 
 
+@task
+def webserver_restart():
+    """
+    Restarts the webserver that is running the Django instance
+    """
+    try:
+        run("kill -HUP $(cat %s)" % GUNICORN_PIDFILE)
+    except:
+        webserver_start()
+
+
 def _is_webserver_running():
     try:
         pid = int(open(GUNICORN_PIDFILE).read().strip())
         local(_webserver_command())
 
 
-@task
-def webserver_restart():
-    """
-    Restarts the webserver that is running the Django instance
-    """
-    try:
-        run("kill -HUP $(cat %s)" % GUNICORN_PIDFILE)
-    except:
-        webserver_start()
-
-
 def build_static():
     with virtualenv(VENV_DIR):
         with cd(SRC_DIR):
     install_dependencies()
     update_database()
     build_static()
-
     webserver_start()