#๐Ÿ”’ How do i host a program somewhere

53 messages ยท Page 1 of 1 (latest)

odd olive
#

I have a python program that consists of a text boxt and some printed output. I want to host this somewhere (like github pages) where you can go to the pages website and enter text/get responses. How would I do this?

dense graniteBOT
#

@odd olive

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

south yacht
odd olive
south yacht
#

You need to render and take input from a webpage, i.e. through a HTML template.

south yacht
wraith vine
#

GitHub pages won't work for this either, GitHub pages only deals with static pages, if you want to use python then you need a backend

south yacht
#

Assuming that this little program doesn't have anything extensive in the backend, it can be frozen to HTML and Javascript so it can run on Github Pages

#

!pip Frozen-Flask but still have to import it to Flask first

dense graniteBOT
#

Freezes a Flask application into a set of static files.

Released on <t:1707489133:D>.

odd olive
#

and wdym by import to flask

south yacht
south yacht
# odd olive and wdym by import to flask

!pip flask is a web app. You have to import your script into the views of Flask so it works as a web app. Then freeze your Flask app with Frozen-Flask so that it works statically for serverless service like Github Pages/Vercel/Netlify etc

dense graniteBOT
#

A simple framework for building complex web applications.

Released on <t:1712517971:D>.

south yacht
# odd olive

Yeah that's not something Github Pages can help

#

Or any serverless static service

odd olive
#

so whats the alternative

south yacht
#

You'll have to rent a VPS at least and host your service there

odd olive
#

so I can use like google cloud or something?

south yacht
#

Yes

#

AWS/GCP/Azure/Tencent/IBM/etc

#

Lots of cloud services

odd olive
#

is it usually expensive?

south yacht
#

You can start really cheap. The cheapest at DigitalOcean is $4 per month

#

Of course, you get what you paid for. Low specs

#

But its decent for the price

odd olive
#

so with flask, will my program run exactly the same? it currently gets data from github and stores user entries via an api to like jsonbin

south yacht
#

Flask just turns your terminal/cli/text-based program into a web app

#

So its a cosmetic upgrade

odd olive
#

and can I do this from google collab?

south yacht
#

Google Collab is different

odd olive
#

not like host

#

but can I build the flask stuff there

south yacht
#

You can do this in google collab for sure but not sure about what you're doing

#

I know Google Collab can do AI code stuff but not beyond that

#

Its just an online Jupyter notebook

odd olive
#

yea thats what I mean

south yacht
#

And no, you can't build Flask stuff in Google Collab

odd olive
#

why not

south yacht
#

Because it has its own UI

odd olive
south yacht
#

If you're hosting on a VPS, then do everything in your VPS

#

Including your own Jupyter notebook

#

Don't need Google Colab and its throttled GPU

odd olive
#

ok thank you!

south yacht
#

idk if you need more GPU?

#

I'm sure you can use other cloud hosted GPU service

dense graniteBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.