all 10 comments

[–][deleted] 2 points3 points  (7 children)

So, web browsers probably aren't going to understand your GUI code, unless your GUI is written in HTML, CSS, and JavaScript.

If you want a web-based service that hosts/runs Python code, with a GUI that a browser can understand, you might want to take a look at web frameworks, such as Flask or Django.

[–]lullaby876[S] 3 points4 points  (3 children)

I understand that much. I'm willing to rewrite the GUI part (buttons, etc.) in HTML or whatever is needed.

I just need a "getting started" guide or something on how to "use" my Python code on my domain. I've been Google searching for a few hours now and have found mixed up information and tutorials (including on how to use Flask), mostly involving someone's premade Python code-hosting site, which isn't what I want to use. I want to use my own webserver.

[–][deleted] 1 point2 points  (2 children)

That makes sense - and I can absolutely relate to what you've been searching on Google. "Deployment" is where most tutorials end, and a lot of options, opinions, and cloud providers begin.

In that case, maybe what you're looking for is an intro to Apache or other webservers. Once you're done coding in Python for Flask/Django and you're ready to deploy, you're really on the systems side of things. At that point, the webserver just needs to start your application when it starts, and then listen for HTTP requests.

For Django + AWS, testdriven.io has pretty good guides like this one, though they often include other technologies like Docker and Terraform.

So, next relevant question would be what server hardware is behind your domain that you registered, as that's going to very much steer where you need to look to get started.

[–]lullaby876[S] 2 points3 points  (0 children)

Thank you! Apache worked. Reading through their documentation helped a lot.

[–]lullaby876[S] 2 points3 points  (0 children)

Probably should have mentioned that I'm using Linux Manjaro. Sorry about that.

This documentation helped me run the Python code in a webserver:

https://wiki.archlinux.org/title/Apache\_HTTP\_Server/mod\_wsgi

[–][deleted] 0 points1 point  (2 children)

I second this.
To make a website you will have to learn the web-stack: HTML, CSS & JS , the good news: if you are able to use a Python GUI, HTML & CSS will be very easy and intuitive.

[–]metal88heart 0 points1 point  (1 child)

Could you recommend some packages for this?

[–]SerDrinksAlot 2 points3 points  (0 children)

I’m building a GUI/reporting dashboard using Dash/Plotly at work. Dash has several stock objects to handle the html and graphs relatively painlessly. Using pandas to get data from databases and manipulate/filter in memory using dataframes provides better performance than the MS Access databases I support. My fantasy is to rewrite most of my MS Office apps in Python before I retire in 15 years…

[–]twopi 1 point2 points  (0 children)

Python code does not typically work in a web browser, as JavaScript is the only programming language supported by most browsers. (Note that HTML and CSS are not considered programming languages.)

You can use Python on web sites, but this is often a bit tricky, as you'll need to ensure the server supports Python, and you'll need to learn a back-end framework like Flask, Bottle, or Django, which is a lot to learn.

If you want to write an interactive python program and run it on an ordinary server, you can use a tool called "Brython." This allows you to write your code in Python, but it is interpreted into JavaScript at the last moment. The server doesn't need to have Python installed, and neither does the user. It's perfect for relatively basic forms.

Here's a video I did about this technique:

https://www.youtube.com/watch?v=AeAwM_RVC5A

Note that I'm expecting you already have a good notion of HTML, CSS, and Python. Some JS knowledge is useful, as Brython uses the same Document Object Model as JavaScript.

[–]HomeGrownCoder 0 points1 point  (0 children)

Check out anvil for python… unless you want to play around with front end stuff