Package commands :: Module create_sqlite_file
[hide private]
[frames] | no frames]

Source Code for Module commands.create_sqlite_file

 1  import os 
 2  import flask 
 3  import click 
 4  from coprs import app 
5 6 7 -def create_sqlite_file_function():
8 with app.app_context(): 9 uri = app.config["SQLALCHEMY_DATABASE_URI"] 10 11 if not uri.startswith("sqlite"): 12 return None 13 14 # strip sqlite:/// 15 datadir_name = os.path.dirname(uri[10:]) 16 if not os.path.exists(datadir_name): 17 os.makedirs(datadir_name)
18
19 @click.command() 20 -def create_sqlite_file():
21 """ 22 Create the sqlite DB file (not the tables). 23 Used for alembic, "create-db" does this automatically. 24 """ 25 return create_sqlite_file()
26