
When using local mysql, this class is useful to automate database creation. Also add the ability to configure database name, so it can match the name created on mysql class. Change-Id: I9c97b4a6355816b931e93d053f4748ef88f0a823
37 lines
1008 B
Plaintext
37 lines
1008 B
Plaintext
import os
|
|
|
|
from werkzeug import script, create_environ, run_wsgi_app
|
|
from werkzeug.serving import run_simple
|
|
|
|
from lodgeit import local
|
|
from lodgeit.application import make_app
|
|
from lodgeit.database import session
|
|
|
|
dburi = 'mysql://<%= @db_user %>:<%= @db_password %>@<%= @db_host %>:3306/<%= @db_name %>'
|
|
|
|
SECRET_KEY = 'no secret key'
|
|
|
|
def run_app(app, path='/'):
|
|
env = create_environ(path, SECRET_KEY)
|
|
return run_wsgi_app(app, env)
|
|
|
|
action_runserver = script.make_runserver(
|
|
lambda: make_app(dburi, SECRET_KEY),
|
|
use_reloader=True)
|
|
|
|
action_shell = script.make_shell(
|
|
lambda: {
|
|
'app': make_app(dburi, SECRET_KEY, False, True),
|
|
'local': local,
|
|
'session': session,
|
|
'run_app': run_app
|
|
},
|
|
('\nWelcome to the interactive shell environment of LodgeIt!\n'
|
|
'\n'
|
|
'You can use the following predefined objects: app, local, session.\n'
|
|
'To run the application (creates a request) use *run_app*.')
|
|
)
|
|
|
|
if __name__ == '__main__':
|
|
script.run()
|