ModuleNotFoundErrors when trying to export_workspace_applications

Please fill in the questionnaire below.

Technical Help Questionnaire

Have you read and followed the instructions at: *READ ME FIRST* Technical Help FAQs - #2 by nigel ?

Answer: Yop

Self-Hosted Installation and Setup Questions

docker run \
>   -d \
>   --name baserow \
>   -e BASEROW_PUBLIC_URL=https://app.XXX.de \
>   -e BASEROW_CADDY_ADDRESSES=:443 \
>   -v baserow_data:/baserow/data \
>   -p 80:80 \
>   -p 443:443 \
>   --restart unless-stopped \
>   baserow/baserow:1.23.2

How have you self-hosted Baserow.

VM on MS Azure

Which version of Baserow are you using.

1.23.2

Describe the problem

Describe, step by step, how to reproduce the error or problem you are encountering.

I tried to export_workspace_applications in order to provide a template for myself that I can reuse in different workspaces or just import the export. (Basically I need to duplicate a database template into another workspace.)

This is what I did (some trouble-shooting included already):

ssh -i XXX

docker exec -it baserow bash

cd /baserow

source /baserow/venv/bin/activate

export DJANGO_SETTINGS_MODULE='baserow.config.settings.base'
export DATABASE_PASSWORD='XXXXXXXXXXXX'
export DATABASE_HOST='localhost'  

export PYTHONPATH="/baserow/backend/src:$PYTHONPATH" #This solved my first ModuleNotFoundError: No module named 'baserow'

python3 /baserow/backend/src/baserow/manage.py export_workspace_applications 54 --indent

Forgot to post the error, sorry:

Could not import %s baserow_premium
No module named 'baserow_premium'
Could not import %s baserow_enterprise
No module named 'baserow_enterprise'
Traceback (most recent call last):
  File "/baserow/backend/src/baserow/manage.py", line 41, in <module>
    main()
  File "/baserow/backend/src/baserow/manage.py", line 37, in main
    execute_from_command_line(sys.argv)
  File "/baserow/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/baserow/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 420, in execute
    django.setup()
  File "/baserow/venv/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/baserow/venv/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/baserow/venv/lib/python3.9/site-packages/django/apps/config.py", line 193, in create
    import_module(entry)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'baserow_premium'

Is this a bash script that you’ve created so that you can run the export_workspace_applications inside the container? If so, then we have a script that you run to do that.

You can do that outside of the container by running docker exec baserow ./baserow.sh backend-cmd manage export_workspace_applications 54 --indent. More information can be found here: Install with Docker // Baserow.

Or inside the container by running ./baserow.sh backend-cmd manage export_workspace_applications 54 --indent.

The baserow.sh script automatically sets the correct environment variables needed to run the command.

Edit: Found it at /baserow/backend.

Thank you very much @bram ! I ran the command, but now I cannot find the exported files. Can you point me what would be the next step? I want to create a template of a workspace that we can reuse and try to follow the instructions at Create a template // Baserow.

Thank you!

ranftler@xelper-analysis-vm:~$ docker exec baserow ./baserow.sh backend-cmd manage export_workspace_applications 54 --indent
 [STARTUP][2024-04-19 22:09:23] No DATABASE_HOST or DATABASE_URL provided, using embedded postgres.  
 [STARTUP][2024-04-19 22:09:23] Using embedded baserow redis as no REDIS_HOST or REDIS_URL provided.   
 [STARTUP][2024-04-19 22:09:23] Importing REDIS_PASSWORD secret from /baserow/data/.redispass  
 [STARTUP][2024-04-19 22:09:23] Importing SECRET_KEY secret from /baserow/data/.secret  
 [STARTUP][2024-04-19 22:09:23] Importing BASEROW_JWT_SIGNING_KEY secret from /baserow/data/.jwt_signing_key  
 [STARTUP][2024-04-19 22:09:23] Importing DATABASE_PASSWORD secret from /baserow/data/.pgpass  
OTEL_RESOURCE_ATTRIBUTES=service.namespace=Baserow,service.version=1.23.2,deployment.environment=unknown

Hi @dranaway, do you see the workspace_54.json and workspace_54.zip file being created after running the export_workspace_applications command? You could, for example, run ls | grep workspace_ to find them, for example.