level12 / keg-app-cookiecutter

0 stars 0 forks source link

Create a user for the primary developer upon DB init #43

Closed rsyring closed 5 years ago

rsyring commented 6 years ago

Could do this in Keg Auth, but since the app is likely to customize the user, maybe we should do it in the app instead?

Can tie into Keg's db_init_post signal or, as long as DatabaseManager is being customized in app.py can just do:

    def db_init(self):
        super().db_init()
        # If all the developer variables are set, then create our first user.
        try:
            ents.User.add(
                name=self.app.config['DEVELOPER_NAME'],
                email=self.app.config['DEVELOPER_EMAIL'],
                password=self.app.config['DEVELOPER_PASSWORD'],
                is_verified=True,
            )
        except KeyError:
            pass
guruofgentoo commented 6 years ago

Definitely in the app.