websetup.py
32 lines
| 885 B
| text/x-python
|
PythonLexer
/ pylons_app / websetup.py
Marcin Kuzminski
|
r0 | """Setup the pylons_app application""" | ||
r327 | ||||
r473 | from os.path import dirname as dn | |||
r327 | from pylons_app.config.environment import load_environment | |||
from pylons_app.lib.db_manage import DbManage | ||||
Marcin Kuzminski
|
r0 | import logging | ||
r327 | import os | |||
import sys | ||||
r469 | ||||
Marcin Kuzminski
|
r0 | log = logging.getLogger(__name__) | ||
r327 | ROOT = dn(dn(os.path.realpath(__file__))) | |||
sys.path.append(ROOT) | ||||
r473 | ||||
Marcin Kuzminski
|
r0 | def setup_app(command, conf, vars): | ||
"""Place any commands to setup pylons_app here""" | ||||
r459 | log_sql = True | |||
tests = False | ||||
r473 | REPO_TEST_PATH = None | |||
r459 | ||||
r491 | dbname = os.path.split(conf['sqlalchemy.db1.url'])[-1] | |||
r459 | ||||
dbmanage = DbManage(log_sql, dbname, tests) | ||||
r327 | dbmanage.create_tables(override=True) | |||
r459 | dbmanage.config_prompt(REPO_TEST_PATH) | |||
dbmanage.create_default_user() | ||||
r327 | dbmanage.admin_prompt() | |||
dbmanage.create_permissions() | ||||
r417 | dbmanage.populate_default_permissions() | |||
r365 | load_environment(conf.global_conf, conf.local_conf, initial=True) | |||
r327 | ||||