-
Notifications
You must be signed in to change notification settings - Fork 105
Open
Labels
Description
When working on code that interacts with Google Cloud Storage (GCS), it's often useful to be able to explore the files that exist in our local emulated GCS. You can do this as follows:
- Run the local dev server
- Open a shell to the oppia-dev-server container:
make shell.oppia-dev-server - Start a Python session
python - Depending on what Oppia tools you want to use, you may need to run
import scripts.startto get Python to look in the correct folders for imports. - import
models:from core.platform import models - Set up
storage_services:storage_services = models.Registry.import_storage_services()
Now you can explore GCS as follows:
# The `abc` is the GCS bucket name, which you can put anything for.
>>> storage_services.listdir('abc', 'exploration_suggestions/25/assets')
[EmulatorBlob(name=exploration_suggestions/25/assets/image/img_20241203_121203_tn09emjdm7_height_472_width_314_micro.svg, content_type=image/svg+xml), EmulatorBlob(name=exploration_suggestions/25/assets/image/img_20241203_121203_tn09emjdm7_height_472_width_314_compressed.svg, content_type=image/svg+xml), EmulatorBlob(name=exploration_suggestions/25/assets/image/img_20241203_121203_tn09emjdm7_height_472_width_314.svg, content_type=image/svg+xml)]You can also mutate files in GCS. See the available functions here: https://github.com/oppia/oppia/blob/develop/core/platform/storage/dev_mode_storage_services.py
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo