install.py 575 B

12345678910111213141516171819202122232425
  1. # -*- coding: utf-8 -*-
  2. from demeter.core import *
  3. #CREATE DATABASE IF NOT EXISTS yourdbname DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
  4. def manage():
  5. model = Demeter.model('manage_admin')
  6. model.id = 1
  7. info = model.select(type='fetchone')
  8. if not info:
  9. model.role_id = 1
  10. model.username = 'admin'
  11. model.mobile = '15810090845'
  12. model.password = '123456'
  13. model.insert()
  14. model = Demeter.model('manage_role')
  15. model.id = 1
  16. info = model.select(type='fetchone')
  17. if not info:
  18. model.name = u'管理员'
  19. model.insert()
  20. manage()
  21. Demeter.echo('install success!')