You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 lines
1.0 KiB

  1. # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
  2. # MIT License. See license.txt
  3. # make public folders
  4. from __future__ import unicode_literals
  5. import os
  6. import webnotes
  7. def make(site=None):
  8. """make public folder symlinks if missing"""
  9. from webnotes.utils import get_site_base_path, get_base_path, get_path
  10. webnotes.init(site=site)
  11. site_path = get_site_base_path() if site else get_base_path()
  12. # setup standard folders
  13. for param in ("public_path", "backup_path", "files_path"):
  14. path = os.path.join(site_path, webnotes.conf.get(param))
  15. if not os.path.exists(path):
  16. os.mkdir(path)
  17. # setup js and css folders
  18. if not site:
  19. for folder in ("js", "css"):
  20. path = get_path(webnotes.conf.public_path, folder)
  21. if not os.path.exists(path):
  22. os.mkdir(path)
  23. os.chdir(webnotes.conf.public_path)
  24. symlinks = [
  25. ["app", "../app/public"],
  26. ["lib", "../lib/public"],
  27. ]
  28. for link in symlinks:
  29. if not os.path.exists(link[0]) and os.path.exists(link[1]):
  30. os.symlink(link[1], link[0])
  31. os.chdir("..")