__init__.py 806 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. demeter init
  5. author:rabin
  6. 这里写页面逻辑
  7. """
  8. import os
  9. path = os.path.split(os.path.realpath(__file__))[0] + '/'
  10. files = os.listdir(path)
  11. url = []
  12. for key in files:
  13. if '.DS_Store' not in key and '__' not in key and 'pyc' not in key:
  14. key = key.replace('.py', '')
  15. __import__(key, globals())
  16. #str = 'import ' + key
  17. #exec(str)
  18. dirs = 'str=dir('+key+')'
  19. exec(dirs)
  20. for i in str:
  21. act = ''
  22. if '_path' in i:
  23. act = i.replace('_path', '')
  24. if '_html' in i:
  25. act = i.replace('_html', '.html')
  26. if act:
  27. attr = 'attr='+key+'.'+i+''
  28. exec(attr)
  29. if key == 'main' and act == 'index':
  30. url.append((r'/', attr))
  31. elif key == act:
  32. url.append((r'/'+act, attr))
  33. url.append((r'/'+key+'/'+act, attr))