Django database integration


I am new here.
I was wondering if I can create a Django project and use baserow as my database (postgres), since I have a baserow self hosted account.

Do you know if this is possible?

Kind regards

Hi @tuliobem, yes this is possible to do via API. That means that you would issue HTTP requests instead of using the Django ORM. Or do you want to connect directly to Baserow database and manage your Django table there?

1 Like

Dear @petrs many thanks for your reply.
I am interested in the second option you suggested, since I was able to connect a http postgres database and handle data directly on it.
My intention is more related to your second proposition, which is to setup a Django project and connect its database directly in baserow (therefore replacing the sqlite3 which comes with Django). Is that possible?
I found an article about “How Baserow lets users generate Django models on the fly” but I am not advanced enough to comprehend this.
Kind regards

Yes it is possible, but given that the Django models are generated on the fly, it is definitely a little bit advanced.

The first step would be to access the Baserow code already written around accessing the tables, which you can do by either forking Baserow, creating your app as a Baserow plugin, installing Baserow Django app as a dependency, or simply vendoring in the code you need (copy pasting MIT-licensed Baserow code into your app).

You would definitely need to do some digging in the source code to find the parts of the code you need.

Bear in mind that you can always query the tables with SQL or just define a static Django model for a specific table. However, using the code we already have would allow you to work with any table and any Baserow concept such as filters and other things.

Dear Petr,

Good news that it is possible.

I understood that I should install baserow (self hosted) which will be a baserow-django-project by definition. Then I can access its code and from there install my Django apps and use baserow-django-project as my own django project, is that correct?

I have already followed this Docker /Ubuntu installation guide on your website. I was able to install it on an Ubuntu AWS lightsail server (self hosted). From there it is not very clear how to access the code, or how to access baserow-django-project files and folders (ex. / / / / etc). Although I was able to manage baserow just like the Saas version, I noticed that my installation did not activate SMTP and webhooks.

I am not sure whether you can guide me on this, or maybe you can recommend someone here in Brazil to help me. If you agree we can schedule a video-conference, where I open any Ubuntu Cloud Server on my screen and you guide me through this process as you described above.

Today I found this tutorial below. This is still beyond my knowledge but if you tell this can work, I will try my best to make it happen: Baserow

kind regards,

Hey there :slightly_smiling_face:

If you want to edit the Baserow code or use it as a dependency you shouldn’t do so on your server but rather locally on your machine.

So instead of deploying Baserow and then trying to edit the code, you should fork Baserow, edit the code, and then deploy the edited code.

@tuliobem Have you seen our plugin documentation and guides? Introduction // Baserow

I’d recommend using a Baserow plugin if you want to get custom python code running with Baserow currently.