Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
an httpd server
#1
Python has module smtpd that implements an SMTP server. why not also httpd? other server protocols?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
There is an HTTP server in the standard library - see the http.server module. Note that there are also third party HTTP servers like Gunicorn that are likely better for production use.

As for the question about why certain things are included in the standard library and not, that's a question for the library developers.
Reply
#3
ndc85430 Wrote:Note that there are also third party HTTP servers like Gunicorn that are likely better for production use.
I've always missed an effective tutorial about the simplest and secure way to deploy a flask or a django web site. If you feel like writing such a tutorial please do! You could title it Python web deployment for dummies!
Reply
#4
Honestly, I just deploy all my personal apps on Heroku. Their docs are pretty good and things are pretty easy. Other cloud solutions are available (AWS, Google Cloud Platform, etc.) but I've not used them, so can't comment.
Gribouillis likes this post
Reply
#5
Can start the build in HTTP server that ndc85430 mention with:
python -m http.server 8000
So it's a basic working server,will show all files in folder you run it in if in browser go to http://localhost:8000.
I used some time to transfer files on fly(shut down when finish),it will also work over web and not just locally if point to IP address of machine running from.
Of course not a production environment solution.
According to the official Python docs, it only implements basic security checks.
Serving Files with Python's SimpleHTTPServer Module
See later in tutorial that serve HTML as demo,but not something would mess with all as eg Flask,Django dos this much better.
Reply
#6
(Jan-03-2022, 05:32 AM)ndc85430 Wrote: As for the question about why certain things are included in the standard library and not, that's a question for the library developers.
it would be more of a question about the naming scheme, given that there is such a server. i just didn't see it because the naming scheme was different. i was looking for "httpd". but it is known, now, and i can avoid creating my own (i wrote one in C many years ago).
(Jan-03-2022, 09:15 AM)ndc85430 Wrote: Honestly, I just deploy all my personal apps on Heroku. Their docs are pretty good and things are pretty easy.
can you describe the scope of how it operates? is it a module or an executable? can you show a very minimal web server using it? just a simple single page hardcoded in the Python code, like a "hello world" page that can be modified from there? i want to deploy a simple "your IP address is ..." page that i can record logs from. the logs would be recording which VPN the connection cam through.
(Jan-03-2022, 12:09 PM)snippsat Wrote: Of course not a production environment solution.
i just need to get source/remote IP address and output it. then i want to add some other info. only i will be accessing it, so i'll use secret port number 24179.
i also want to make a web server that stores all URLs in a big lookup table indexed by a long random number. when the object has been stored, it is added to that database using a new random number. web web pages in HTML are served, all URL references are translated to the random number in URL form. the client is making requests by number and these get translated by the server going in and out. the client only sees the random numbers and the files have normal URLs. thus the site structure is hidden from clients/users.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#7
(Jan-05-2022, 12:21 AM)Skaperen Wrote: can you describe the scope of how it operates? is it a module or an executable? can you show a very minimal web server using it?

Heroku is a cloud platform for running applications - they manage the infrastructure for you and you give them your app and a file that specifies how to run it. They have a variety of pricing plans, including a free one that has some limitations (like your app having to be asleep for some amount of time, but that hasn't been a problem for me). You can get add-ons, too, like services that provide databases (I'm using their Postgres offering in a number of my projects, for example).
Reply
#8
(Jan-03-2022, 09:15 AM)ndc85430 Wrote: Honestly, I just deploy all my personal apps on Heroku. Their docs are pretty good and things are pretty easy. Other cloud solutions are available (AWS, Google Cloud Platform, etc.) but I've not used them, so can't comment.
can you comment why you chose Heroku to begin with? is there a price advantage?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#9
I actually didn't look at other offerings. I tried it out and it was suitable for my projects and continues to be so. I'm only using the free plan, but again, that's perfectly fine for me.
Reply
#10
so it's not an infrastructure service but an application service. does it assume everything is HTTP(S) or can you you also do other protocols?

i am working up a way to deploy a server across multiple services (AWS. Azure, Google Cloud, etc) that lets you have your redundancy protect you even from a total provider company outage.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020