DotaNoobs main site.
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.

26 lines
690 B

  1. #!venv/bin/python
  2. import os
  3. from flask import Flask
  4. from flask.ext.script import Manager, Server
  5. from flask.ext.migrate import Migrate, MigrateCommand
  6. from app import *
  7. basedir = os.path.abspath(os.path.dirname(__file__))
  8. app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'app.db')
  9. migrate = Migrate(app, db)
  10. manager = Manager(app)
  11. manager.add_command('db', MigrateCommand)
  12. @manager.command
  13. def admin(name):
  14. u = models.User.query.filter_by(nickname=name).first()
  15. if u and not u.admin:
  16. u.admin = True
  17. db.session.commit()
  18. print "User {} has been granted admin access.".format(name)
  19. if __name__ == '__main__':
  20. manager.run()