Tweaks fo manage.py to allow default project creation

This commit is contained in:
Francesco Siddi 2016-03-24 16:05:39 +01:00
parent a33e4421a8
commit 84723eb8d3

View File

@ -141,9 +141,12 @@ def setup_db():
summary='Default Project summary', summary='Default Project summary',
category='training' category='training'
) )
project = post_internal('projects', project) # Manually insert into db, since using post_internal would trigger hook
print("Created default project {0}".format(project[0]['_id'])) # TODO: fix this by bassing the context (and the user to g object)
gcs_storage = GoogleCloudStorageBucket(str(project[0]['_id'])) projects_collection = app.data.driver.db['projects']
project = projects_collection.insert_one(project)
print("Created default project {0}".format(project.inserted_id))
gcs_storage = GoogleCloudStorageBucket(str(project.inserted_id))
if gcs_storage.bucket.exists(): if gcs_storage.bucket.exists():
print("Created CGS instance") print("Created CGS instance")