PageRenderTime 38ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

Plain Text | 34 lines | 27 code | 7 blank | 0 comment | 0 complexity | cd9474a76cfc4e4bb9969f61d6e86023 MD5 | raw file
Possible License(s): GPL-2.0
  1. Management Scripts
  2. ==================
  3. Let's say you want to write a script to do an import or some other
  4. management task. This is nice and easy to do locally during
  5. development, but then if you want to use that command in production
  6. this is harder. A typical example is a script to import raw data.
  7. Silver Lining has support for running commands on applications, as
  8. though they were local applications. It looks like this::
  9. $ cd myapp-app
  10. $ silver run LOCATION import-script --setting=value ~/
  11. ``silver run`` takes as an argument the name of the script to run;
  12. this should be a script that has been uploaded to the server (either a
  13. path relative to your app root, or a script in your app's ``bin/``
  14. directory). If you edit the file locally and don't do ``silver
  15. update`` remember that it will use the old version of the script.
  16. The script must be a Python script. The path will be appropriately
  17. setup so all your libraries will be ready, and environmental variables
  18. set, and then the script will be run, passing all arguments you
  19. provide to the script.
  20. Also any arguments that you pass that point to a file or directory
  21. that exists will cause those files to be uploaded, and the remote
  22. filenames will be substituted. So in the example
  23. ``~/`` will be uploaded to the server.
  24. Note that these scripts can be run as ``www-data`` (the default) or
  25. you can use ``--user=www-mgr`` to run the script as ``www-mgr`` (the
  26. normal user used to manage the deployment of scripts) or
  27. ``--user=root`` to run the script as ``root``.