#!/usr/bin/env python # -*- coding: utf-8 -*- """ demeter init author:rabin 这里写页面逻辑 """ import os path = os.path.split(os.path.realpath(__file__))[0] + '/' files = os.listdir(path) url = [] for key in files: if '.DS_Store' not in key and '__' not in key and 'pyc' not in key: key = key.replace('.py', '') __import__(key, globals()) #str = 'import ' + key #exec(str) dirs = 'str=dir('+key+')' exec(dirs) for i in str: act = '' if '_path' in i: act = i.replace('_path', '') if '_html' in i: act = i.replace('_html', '.html') if act: attr = 'attr='+key+'.'+i+'' exec(attr) if key == 'main' and act == 'index': url.append((r'/', attr)) elif key == act: url.append((r'/'+act, attr)) url.append((r'/'+key+'/'+act, attr))