I build a PurchaseOrder system using Django for my client. It’s a self-hosted system.
I like to use Baserow UI to allow my clients to fill up data and retrieve data based on the models I create in the PurchaseOrder.
I am not sure how to do this? ideally the self-hosted part should be a separate Django app in the same codebase somehow. That way, then the BaseRow backend can access my custom written models.
I am already using docker to run the postgres and django portions on the production server.
I don’t mind exposing the baserow brand name. I just want that UI to allow my non technical end users have a more pleasant way of interacting with my custom django project data.
Can explain to me how to get this done if possible?
I also am taking @olgatrykush advice to simply post my question here as advised here
Just to double check, you want to use Baserow as a GUI for existing normal Django models inside your codebase? Right now Baserow can only display its own special user generated models, and does not support rendering other Django models in its Grid views etc. I’ve attempted to add support so Baserow can display any Django model previously, I believe it is possible however it is complicated and so I wasn’t able to finish this.
If you were instead to make Purchase Order/your other tables in Baserow using Baserows API/GUI, you could then access Django models representing these tables using our python API:
So right now i am running a Django 3.2 container on a Ubuntu image, and a postgres container using postgres image and all the containers running in Docker.
What’s the easiest way to install Baserow in a way that integrates with my existing setup?
In fact, this is my local.yml which is very similar to my production.yml
version: "3.9"
volumes:
postgres14_data_local: {}
postgres14_backup_local: {}
services:
django:
platform: linux/amd64
build:
context: .
dockerfile: ./compose/local/django/Dockerfile
image: eno-a3-django_local_django
stdin_open: true # Add this line into your service for PDB debugger to work
tty: true # Add this line into your service for PDB debugger to work
depends_on:
- mailhog
- redis
- postgres_14
volumes:
- .:/app
env_file:
- ./.envs/.local/.django
- ./.envs/.local/.postgres_14
ports:
- "8000:8000"
command: /start
postgres_14:
platform: linux/amd64
build: ./compose/production/postgres_14/
image: eno-a3-django_production_postgres_14
container_name: postgres
# command: postgres -c config_file=/etc/postgresql.conf
volumes:
- postgres14_data_local:/var/lib/postgresql/data
- postgres14_backup_local:/backups
- ./compose/production/postgres_14/postgresql.conf:/etc/postgresql.conf
env_file:
- ./.envs/.local/.postgres_14
ports:
- "5432:5432"
mailhog:
image: mailhog/mailhog:v1.0.0
ports:
- "8025:8025"
redis:
platform: linux/amd64
build: ./compose/production/redis/
container_name: eno-a3-django_local_redis
restart: always
Currently we don’t publish Baserow as an installable Django app (though we want to one day!). That means you are probably going to have to resort to using something like git submodules and cloning our entire code base into your own and then manually hooking everything yourself in your own Django app.
Alternatively you could run Baserow standalone completely separately. Use Baserow and create the tables you want inside of it, and then access the postgres tables Baserow created in its database in a separate Django application or using Baserow’s webhook features to integrate the two apps. This is probably much easier until we offer an easy way of installing Baserow as a Django app.
You should state what is really your goal here. The original poster wanted to use Baserow to edit his existing tables managed by Django for instance. That is not possible - Baserow works with its own tables.
Baserow is not just a single Django app, but a collection of various applications (separate Django apps, code intended to be run with Celery workers, separate frontend that requires itw own server). It is not trivial and certainly not anywhere near the typical use of third-party Django apps and libraries.
Fair point, here’s what I have in mind.
I have a saas django app running completely separate from baserow. Then I also have a baserow plugin which I deploy a standalone instance (Words). I would like to integrate the two more deeply. Here are the issues that bother me:
Authentication: users will have to create another account on the baserow site, will get confused about why the password is not the same, etc.
API integration: I would like the django app to be able to list workspaces, tables, and access tables. This will require every new user to setup their API keys properly.
Though thinking about it further, there may be some advantages in keeping the apps separate, but writing some code to facilitate integration. It does sound like transforming baserow to a django app would be a monumental effort, if on top of that it’s not officially supported by baserow, then I’m potentially signing myself up for a lot of work.
It does sound like transforming baserow to a django app would be a monumental effort, if on top of that it’s not officially supported by baserow, then I’m potentially signing myself up for a lot of work.
Yes. It would be certainly easier to do it other way around: use all Baserow setup that exists already, with docker images and what not - and add your app to the Baserow project.
It all really depends on how coupled or decoupled you would want things to be. It is hard to offer any general advise here.
For auth you could reuse Baserow tokens in your own app and keep users in Baserow or just use one admin user in Baserow but manage your own permissions on top (use Baserow just as a permission-less storage).
For API integration: you could try to access Baserow postgres tables directly or use our Django code as a library (bypassing the endpoints). Really the solution can go in many different directions.