When SaaS Is Not Allowed: Shipping Django as a Desktop App

This video features Jochen Wersdörfer at DjangoCon Europe 2026 in Athens, Greece.

When SaaS Is Not Allowed: Shipping Django as a Desktop App
0:30:50
Published October 26, 2026
133 views

TALK: When SaaS Is Not Allowed: Shipping Django as a Desktop App by Jochen Wersdorfer

Some teams face constraints that make standard web deployment impossible: confidential data that must never leave user machines, air-gapped environments, and workloads that are too expensive to run centrally. This talk presents a production pattern for turning Django into a desktop application by packaging it inside Electron. The case study is Steel-IQ, an open-source steel-industry simulation tool for multi-decade decarbonization scenarios, shipped for local execution with sensitive data.

More information: https://2026.djangocon.eu/speakers/BWWWMK/

Follow DjangoCon Europe on social media:
*X - https://x.com/DjangoConEurope/
*LinkedIn - https://www.linkedin.com/company/djangocon-europe/
*Mastodon - https://fosstodon.org/@djangoconeurope

#django #djangocon #djangoconeurope #djangoconeurope2026

Open full transcript Markdown

Transcript

4,500 words · auto-generated · en Show transcript

Automatically transcribed, so expect mistakes in names and technical terms.

Speaker 1

Hello. It is my very great pleasure to introduce Jochen to you, who will be talking to us about Django as a desktop app. Always exciting to hear an interesting new way of using Django. I've been told there's a workshop starting down downstairs as well now if you're wanting to go to that but over to Jochen.

Speaker 2

Hi Okay, hi. Yeah, I'm Jochen Wasslaffer. I do Django application development since about 2013. I have a John Speaking Python podcast. And for my freelance work, I usually do half of the time juggle backend development and the other half I spend on data science and machine learning projects Yeah, and somehow this lately drifted into desktop development because I did this project wrapping Django in an Electron app last year and this year I also do a Qt desktop application using PySight.

So At this point I fear that this might be a punishment for something I did in a past life or something. But yeah, so it is okay Yeah, UIs. This talk is about what you can do when you can't run Django on a on a server. So in the end you should maybe be able to play around with a little demo app and also might get an idea on what to do if you have an existing application that you want to wrap in an desktop application. And yeah, maybe quick question. How many of you

use electron apps on a daily basis Okay, so quite a lot. I think you already made your piece with your text editor taking up to two gigabytes of RAM. Very good. I think we are already friends here. So yeah. Back to the project I did last year This is it's it's steel IQ, it's an open source modeling platform for steel decarbonization. You can use it to run simulations of how to decarbonize steel so furnaces and it contains code for plant economics for running trade flows and geospatial stuff like cost of energy and so on

so on. It's a quite complex domain and But it matters because the steel industry is responsible for about eight percent of all CO two emissions worldwide and knowing which policy changes would maybe bring that down could be important. So Yeah, interesting project. In the beginning we thought about what UI should we use, but the problem is that yeah we knew that we couldn't use a website because We knew that that our target audience has private, sensible proprietary data. They probably don't want to upload anywhere, but they will need it to run those simulations.

And so we thought maybe we just distribute it as a Python package using PyPI or maybe write a command line interface or maybe provide some Jupyter notebooks showing how to run simulations. But yeah, our users are probably domain experts in the steel industry, sitting in front of Excel sheets using Windows desktop computers or worse. And yeah they probably don't run Python at all and they need something they just can install and run. And we had previous experience with using Django for economic models and we were very happy with that. So we thought it would be really cool to

if we if we could keep that. And then we had this wild idea of maybe we can just wrap the Django app in an electron shell and ship it as a desktop application to our users. And we thought, okay, we might try that for one or two weeks, and if it feels wrong, then we try something different. But surprisingly this was this was easier than expected. After one week we had some kind of working prototype and the development didn't feel really like creating a desktop application but just doing normal Django web development. You have your dev server and you work on models and views and stuff like that

And yeah if you if you do development for a website then you also have some point where you deploy it to production side. And for us it was like more like deploying to a desktop application. Like different deployment target, but the develop development process otherwise stayed quite the same similar. So this was a very pleasant surprise so we kept using Django as a UI layer for our project and Yeah in November 2025 we shipped this as a finished product. It took about a year. 15 people were working on that, maybe half of them writing code. Yeah, in the end it was about 100,000 lines of code, so it was not really small.

It was kind of a decently sized project. And yeah, we have real users using that to run simulations in the scene industry. And yeah, this kind of proves that you can do that. It's possible at least. And yeah, it The problem is you can't really use that repository, it's open source. You can look at it but it's it's not really good as a tutorial I think because it's just too big and there are lots of steel domain things in there and edge cases so I for this talk I created a different repository called desktop Django

starter, which is just a small demo shut application and all this things you need to do to make it work in an electron shell And that's has some additional advantages like more ponies, less steel. It also the documentation is also written in with the use case in mind that you might want to wrap your own application in an electron shell. So this might also be useful. And okay, let's let's maybe have a look at the architecture of the demo app that's in there. Yeah, it's a pretty normal Jugo application. So you have a user looking at a UI and a browser window. Providing input by clicking around and

entering keystrokes and then you have the usual response request response cycle to your Django server And yeah, just normal REST stuff. And the Django server then has its application state in the in a database, SQLite in our case. And there's also a task queue for background workers. Oh, we heard this quite a few times today, also yesterday. And in the data layer there's also a file system containing images, fonts, huge upload user-uploaded Excel files. Yeah and the only difference between a normal web application and

this desktop application is this small outer frame called main. js. This is a script. If you double click the app icon then it gets started. It's a node. js script and it starts all the other processes in the system. It's it's orchestrating the lifecycle of all those things in the in the frame. So we let's have a look at the lifecycle in a little bit more detail. So on startup, if you double-click the add icon, then a splash screen is shown so you see something is going on because it takes some time because the first thing it does is running the migrations and then starting the Django

server. And then also the workers, background workers. And if everything is ready, then it will show a browser UI to the to the user. So this is pretty straightforward And yeah, shutdown is a little bit more complicated. If the user quits the app, then all the background workers have to quit too, and the Django server has to quit. And mainjs has to wait briefly for all the processes exiting nicely and if they don't then it has to kill them at some point. And for C L IQ this was also important because the simulations usually take up hours, if not days, and

if you accidentally press the close button on a window and your simulation is termin is being terminated, this would user make user sad. So we had added a dialogue there, asking user Should we really terminate the simulation? And this has had to be done in the JavaScript part because this is the main. js process orchestrating the whole thing. Okay, let's have a look at the background tasks in the database. Yeah, in a in a big production website you would have a lot of services like a caching layer and maybe message queue stuff. We don't have any of that. We just have an SQLite database and background workers.

Yeah, one user clicking around should be even enough for SQLite to scale up to, so it's not a problem. You need background workers because there's always work you need to do which is taking longer than you would usually expect from a HTTP request, like if you do imports of huge Excel files or run simulations or generate reports, stuff like that. Yeah, but this is this is a neat part. This is all working well and not very different from a normal junk application. But then there are some details that are more difficult, hairy details like security.

We are now running a real web server on the user's machine, so we have to kind of make sure that only legitimate requests are handled and therefore we probably need to listen on local hosts only and Then we have to also have CSIF protection for incoming data and tighten up load hosts too. Mitigate against DNS rebinding attacks because other browser windows can also, when there's JavaScript, can interact with our server. But this is this is kind of Django stuff. I think most of the people here know that Unusual part is and more complicated part is the electron part because by default JavaScript that runs in the electron application window

Can access the JavaScript on the on the Node. js backend and require file system and basically do rem yeah. code execution there. So if you have a cross-site script bug or something like that, it can become a remote execution bug, which is kind of you don't want to have. So you have to configure isolate the JavaScript running in the in the browser window from the JavaScript running in the backend. You have to configure a preload bridge that is minimal and stuff like that. And you have to do that because by default it's not on. So this is something you have to do or at least think about. Another difficult thing is packaging. Because

one thing is in physics an electron is a really small and lightweight particle In software. We ship chromium with electrons that's not particularly lightweight. And we also have to add a Python interpreter. We use Python standalone for that. Really cool project relocatable virtual env with UV It's also really, really important parts of the Python infrastructure there. And it's it's we I'm really glad that the Python stand-alone repository now has a stable and future-proof home at Astral, the makers of UV which now have also a really stable and future proof home at OpenAI. But yeah, so

I hope the best. And Yeah, we also bundled the Django apps and assets for those we want to ship in our application. So the bundle can get pretty big. Yeah, then we also have the problem that we want to be able to run it on users machine. Mac OS is the most complicated thing platform there because You have to assign this app bundle and you also have to notarize it, otherwise the gatekeeper process on macOS wouldn't let you start it. Yeah, this is kind of complicated. And also for Windows you only have to sign, but this is also complicated. In the in the starter template, there's infrastructure for that. So if you fork the repository and add your secrets, it should work.

works. You also need a Apple developer account. For Linux it's a little bit easier signing stuff and so but it's in other ways complicated so this is the whole packaging story is not easy. But probably you only have to do it once and if it works then don't touch it. So yeah. Let's do something more fun. Live demo. I just show the small crot application. No, I don't show it because where's the mmm? Maybe where's the monitor? It's probably right or left. Okay. It's on the right. Yeah, I can install it by just dragging the

Icon in the front of the disk image into the applications folder, which you can't see because it's on a different monitor. Uh-huh. Where's my mouse? Oh no. Here. Okay. So it appeared here, 350 megabytes of application bundle, and if I click it. Should open splash no first of course warning dialogue because it's not via the app store, which is I don't know, it's bad probably. And Yeah, no, the splash screen should be shown. Oh, but on the wrong window. I didn't thought of that. This is why you should use videos and not do the live demo

like this, but okay. No, okay. Here's the window, this is the electron application yeah, just normal trut thing, you can change stuff. And yeah, that's a thing just to show that it's possible to run background jobs. So and what's really cool you can you can do stuff here that it's not possible usually on a website. So if you click this button. Then a local folder gets opened up, which is cool. Yeah, but it's also on the wrong window

Which is kind of cool, but it's also kind of scary. But this is going through the preload bridge to the Node. js backend and then this is this is possible. What's also possible, also included in the SATA template, is if I have a look at the version, it's 1. 5 and if you ship chromium you have to update often because all of the all the all the security issues And you have to update your application too because otherwise you get the issues from Chromium. So you need a probably a way to auto-update the stuff. also included so I can just update to one point six.

So you don't see the splash screen. This is really sad. But naja. Okay, so now it's started. Started again. And now it's having the updated version. So okay. So it kind of works. Okay, I just start the presentation again. Okay, next time to video Okay, but

yeah, that's I thought live doing is the fun part. No. Okay. Having a little demo with Crowdapp is not really useful, but what might be actually valuable is wrapping an existing application. Maybe you have some Django application you think, oh this would also be good as a desktop application. So how to do that. Most of the parts stays the same. All the Django parts are nearly all of it stays the same. But there are things that have to change. If you deploy to a production server, you also have a different settings file. Maybe you need to adjust some environment variables, stuff like that is pretty normal, okay

But you also have to think about things like authentication because if you if you sit if you're the only user in front of a desktop application A login window, login form doesn't really make sense. So you have to think about ways on how to skip this or auto-authenticate. Maybe and also navigation is different because in a browser you have back and forward button and in an electron app There's no crowser browser Chrome, so you still want to have a way to go back to the root of your page or go back And there are different ways you can do that. You can add that to the electron part of the application, or maybe in the HTML is also possible. Depends on your use case, but you have to think about that.

Yeah, but it's it's lot more like deploying to a different system and than rewriting it. So I also did a small example to test the starter template. I have this small Django application called Django Resume for managing my CV and resume stuff. I'm the only user, it's a personal workflow, so I thought, okay, this is a good candidate to wrap it in an electron app. And yeah, then I could have just copied and pasted this stuff from the starter template to the Django resume repository, but then thought okay maybe I can just use my favorite slot machine to do the copy and pasting for me and therefore I wrote a skill so you can use it too by just

calling UVX desktop Django starter rep and if you use the good models then it should also be able to one-shot it takes about fifteen minutes. But I would really be interested. I also tested on different Django apps and it kind of worked. If you have something different in mind or your own application that you want to wrap, let's let's maybe do it together after the talk because I'm really interested in how good the skill generalizes and if there are Issues. But yeah, it should somehow work. Okay. Additional thing, we should maybe have a look at some alternatives.

yeah, electron is not the only thing you can use to wrap Django in a desktop shell another one is tori and maybe if i had known about tori one year ago then we would have used that and not electron but I didn't know so but Yeah, both are kind of good. When is this is this a good idea maybe if your use case includes lots of local data you don't have anywhere If you're offline in an air gap environment, have to connect to hardware devices via USB or something like that, you can't reach from a remote server, then desktop application might be the right choice.

Or if you have heavy compute. This was also the case for Steel IQ. So each simulation took about 16 GHz of main memory. and did run for hours and there's also a lot of data involved and all of just the virtual replicas with virtual env with the data science stack inside was well above one gigabyte. So for us, adding Electron in the Chromium browser wasn't really an issue. It was mere rounding error kind of addition. But Tauri uses less resources in this regard. So if you are resource constrained and it matters for your use case, then Tori is maybe a better option also. The security story is a little bit better in Tori. So this might and I also added this

added to the starter template so you can also wrap your application in Tori if you if you like. Then there are pure Python alternatives like PyBebiew, I didn't try that out, but the repository looks good looks great. Positron is the pure Python electron alternative from the Beaver project, which is also good, but It's also included in the SATA template, but it's not it's it's not at as well tested as Tori and Electron and maybe not working that well. And yeah, then things where you have trouble using Django at all is maybe if you target mobile platforms. You can still use it as a backend for the PVA, but running Django on iOS device locally, it

might be possible somehow, but I wouldn't recommend that. And if you if you want to have the same look and feel across platforms then maybe things like Qt or Kiwi are interesting to you. Or if you want to have native look and feel but also be cross-platform, then maybe be Virtoga. That's also stuff you can try. Yeah. Okay. Maybe to summarize this whole thing once again. If you cannot run Django on a on a server, you can still do Django development. Most of the things stay the same. There are things you have to change and which are not that easy, like

are also interesting if you want to make data science stack work on Windows, on clean windows installed. So we had to do some really unholy things to make this work because we were building the application bundles on GitHub Action runners where you can have Windows binaries built and macOS binaries. And you need to copy some DLLs into your relocatable virtual env and stuff like that so it works on clean Windows installs. It's yeah. Security story is complicated, packaging is not easy. But for CLIQ it wasn't really an issue because the issues we had with other things in the project were much bigger, so it was kind of worth it. But if you have a really small thing then it might be too much.

So depends. You might also want to have a look at alternatives, Electron versus Tauri. have a look at your constraints regarding main memory usage or bundle size and platform requirements. Okay. And of course the general expert Python programming advice from David Beasley applies or you can just not do any of that. Thanks.

Speaker 1

Thank you very much. Hands are going straight up. We've got two at the front already.

Speaker 3

Thank you, that's really exciting to see and thank you for putting the that GitHub repo together because That's gonna be the barrier. I've seen people doing this shipping frozen versions of their Python application where they just ship the PyYC files. I guess for privacy or security of the source code type concerns. Did have you experimented with that or is it?

Speaker 2

frozen right the compiled Python files. Yeah, but still I think you have to have different versions for different platforms. I think or things like Py installer, maybe th things like that, where you compile it into an Excel. Yeah, that's also possible. For the cute thing I do at the moment, I use Py installer. That's also possible. But yeah, if you target wrapping a web application then electron autori is probably the best option you have at the moment but you can you can bring any python application in a desktop setting It's but yeah. Okay. Oh

Speaker 4

thanks. If you want to export the data from your the state of your application out of the application, so you Just use a normal menu and you can just export a SQL dump from there or how does it work?

Speaker 2

Yeah of course. If you if you just or you can just copy the SQLite database, it's just a file on the disk. And yeah I don't know if it's if it's portable between platforms, but you can also have it in an export of the of the database, just as SQL. That's that's perfectly possible, yeah It's not implemented. Pardon? No. That's just the database on the disk.

Speaker 1

I think we've got another question over there.

Speaker 5

Yes, hello. I just realized that if you ship your Django application in a Windows or Mac installer, you're also shipping all of your source code inside that installer. Is that a problem for your use case? And could you work around that

Speaker 2

I don't know. Yeah I didn't even th think about that because we ship our source code and it's not a problem. But yes. Yeah I don't think it's really possible to you can obfuscate of course. You can, for example, just put it in a zip file, encrypt a zip file, and then try to hide the key for that encryption encrypted thing or something like that. That would be possible because you can import from a zip file. But Yeah, there's not really a way to compile Python code so that you can't get it back right. So I think it's you can have something like that, but it's would be a little bit a little bit work Yeah, but we don't do any of that.

We just chips the source code source code.

Speaker 5

Thanks.

Speaker 1

Thanks. I think we've got time for one more, if anyone has any. Yep.

Speaker 6

So I just saw that there's online a question. Maybe I can read it and it's from Thomas Turner. I did a talk in DjangoCon at Cardiff, UK years ago and on something very similar And I had a desktop app running in Django. It's been running for quite a few years. My question is, is the code secure? In other words, could somebody reverse engineer it? So it's more or less the same.

Speaker 2

You can probably get at the source code, I think, yes, because it depends a little bit on how you how you build your application bundle, but I think usually you would be able to get the source code. And security, yeah, security is a problem. Also if you if you configure Electron correctly. It's possible to do that so that all is secure, but probably not by default and you have to invest some thought into that. So yeah

Speaker 1

Thank you very much.

Conference

DjangoCon Europe

April 15 - 17, 2026

Athens, Greece

Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.

More videos by Jochen Wersdörfer

More videos from DjangoCon Europe