|
|
@ -1,6 +1,7 @@ |
|
|
|
import os |
|
|
|
import os |
|
|
|
import sys |
|
|
|
import sys |
|
|
|
import transaction |
|
|
|
import transaction |
|
|
|
|
|
|
|
from urllib.parse import urlparse |
|
|
|
|
|
|
|
|
|
|
|
from pyramid.paster import ( |
|
|
|
from pyramid.paster import ( |
|
|
|
get_appsettings, |
|
|
|
get_appsettings, |
|
|
@ -33,6 +34,11 @@ def main(argv=sys.argv): |
|
|
|
setup_logging(config_uri) |
|
|
|
setup_logging(config_uri) |
|
|
|
settings = get_appsettings(config_uri, options=options) |
|
|
|
settings = get_appsettings(config_uri, options=options) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# remove an existing sqlite database to issue a restart |
|
|
|
|
|
|
|
database_url = urlparse(settings['sqlalchemy.url']) |
|
|
|
|
|
|
|
if database_url.scheme == 'sqlite' and os.path.isfile(database_url.path): |
|
|
|
|
|
|
|
os.remove(path) |
|
|
|
|
|
|
|
|
|
|
|
engine = get_engine(settings) |
|
|
|
engine = get_engine(settings) |
|
|
|
Base.metadata.create_all(engine) |
|
|
|
Base.metadata.create_all(engine) |
|
|
|
|
|
|
|
|
|
|
|