Python + Django + HTML in RaspberryPi

Hello,

I really new in django, i’m starting to learn how to work with this and I have a question.

I have done some scripts in python, their working fine in my RaspberryPi
(as you can see: https://youtu.be/qnEMZDzuY2E?list=PLkW5GG7wE8EI2dvLTMzjECLvhfdUsL-_J&t=26 )

But as you can see in the video thats not “pretty”.
Do you know if Django can help me to put this to work in the browser ?
And add some buttons, see the code running just like you see in my video.

Some help, or tips or something would be great :slight_smile:
Thanks

I’ve got a “website” that already runs on a Raspberry Pi 3B+, and it works great. Among other things, it runs shell scripts and displays the results in a web page.

So yes, in general, what you’ve done in the shell can be done as a Django app.

Keep in mind however, in Django, your program isn’t going to be running on the Pi while the web page is displayed. There’s a fundamental difference between a program running on a local machine and the “request / response cycle” of a web app. You may need to rearchitect your app to make it work in a web app environment. (Note to others reading this response - yes, I’m making a generalization, and there are ways around this. But this is fundamentally true in the “base case”.)

1 Like

Ok thats really great …

Can you give me a small example so I can start.
Can you use WeTransfer or something to send me the example code.

Thanks :slight_smile:

What are you looking for a sample for?

If you’re needing help with getting started with Django, I suggest you work all the way through the standard Django Tutorial

Beyond that, I don’t know if there’s any code I can give you that would be of any use to you without knowing a lot more detail about what you’re trying to do, or what it is you think you need assistance with.

1 Like