Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WSGI server vs Web Server
#11
i reference CGI to show that it is not a good choice. i've known this for 2-3 decades. i even wrote an HTTP server that turned request paths into library loads (instead of exec) in C. it benched about 27 times faster than CGI in Apache, probably because it held on to libraries between requests and many different requests used the same library.

i'm very much wanting to see what WSGI is about. i thought it might be about the Python interface, but there being a Ruby version, that is ruled out. to the google to research this.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#12
I know CGI is bad, but if users want to have it.
Reply
#13
if users want to have it in Python then let them run deprecated code or do it the old way.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#14
Exactly.
Reply
#15
(May-27-2019, 07:39 AM)Skaperen Wrote: i'm very much wanting to see what WSGI is about. i thought it might be about the Python interface, but there being a Ruby version, that is ruled out. to the google to research this.
It's is all about the Python interface,there are good project like Gunicorn and uWSGI(eg Instagram use it).
Gunicorn is all Python,so what if it has gotten get inspiration from a similar Ruby project.
This is how Digital Ocean and Heroku good Python host describe Gunicorn:
Quote:Gunicorn is a pure-Python HTTP server for WSGI applications.
It allows you to run any Python application concurrently by running multiple Python processes within a single dyno.
It provides a perfect balance of performance, flexibility, and configuration simplicity.

All Python web-framework(Flask, Django...ect) is today build on top of WSGI.
Flask
Quote:100% WSGI 1.0 compliant

Skaperen Wrote:if users want to have it in Python then let them run deprecated code or do it the old way.
I agree with this,but i gone share my advice of what i think is the best choice for new user staring web-development in Python.

Like 95 percent of my time doing web-development none of this WSGI server stuff matter.
I use the Build development server for all project in Flask,then can focus on learning HTML/CSS/Javascipt without thinking of server stuff before i have to.
Reply
#16
so there are no HTTP (re)definitions in WSGI and the proxies don't need to make any changes other than port number. a WSGI server is basically a persistent thing that calls Python code instead of exec processes as determined by the HTTP request and any appropriate configurations and/or registrations ... it's a HTTP to API interfacer. if i got that right, then i still need to learn it, eventually, to do web development (as opposed to using an existing framework).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#17
(May-27-2019, 06:36 PM)Skaperen Wrote: s a HTTP to API interfacer. if i got that right,
Look at Full Stack Python WSGI Servers for more info.

Quote:then i still need to learn it, eventually, to do web development (as opposed to using an existing framework).
Using WSGI directly for web-development is not a pleasant thing,people who want to create yet another Python web-framework most read the WSGI specification.
There is no need at all for user that want to do web-development in Python,to read the WSGI doc.

Look at Werkzeug it's a thinner layer over WSGI.
Quote:Werkzeug is a comprehensive WSGI web application library.
It began as a simple collection of various utilities for WSGI applications,
and has become one of the most advanced WSGI utility libraries.

From Werkzeug came Flask same Author Armin Ronacher now under Pallets Projects with more developer that keep stuff updated.
With Flask work close to HTML/CSS/JavaScript with very little over head,it's very pleasant to do web-development in.
Django is also good,but it's has an other model that Flask with a lot stuff build in even if need it or not.
Reply
#18
(May-26-2019, 09:40 PM)snippsat Wrote:
(Apr-24-2019, 07:43 AM)chrisdb Wrote: - can I run a wsgi server, without using a web server to run a webapp (i.e. run an angular spa with a rest api in flask with waitress alone)?
The work flow with eg Flask is building the web-app is all done local with Development Server(wsgi) that come with Flask.
If want to share with the world then get a host and then leave development server and then eg go for good option like Gunicorn and Nginx.
Look at this post for host recommendations.

WSGI Servers for a little history.
As a note there no need to dig into WSGI specification,unless you want build yet another Python web-framework.
fullstackpython Wrote:WSGI is by design a simple standard interface for running Python code.
As a web developer you won't need to know much more than
  • what WSGI stands for (Web Server Gateway Inteface)

  • that a WSGI container is a separate running process that runs on a different port than your web server

  • that a WSGI container is a separate running process that runs on a different port than your web server
    your web server is configured to pass requests to the WSGI container which runs your web application,
    then pass the response (in the form of HTML) back to the requester

I don't have the intention to share my SPA with the world.
The application I've written is for local use only. So only 1 user at a time is required. That's why I asked if it is necessary to use a web server if I already have a wsgi server.

Btw I refer to waitress because I want to run my app on Windows too.
Reply
#19
(May-27-2019, 07:35 PM)chrisdb Wrote: I don't have the intention to share my SPA with the world.
The application I've written is for local use only. So only 1 user at a time is required. That's why I asked if it is necessary to use a web server if I already have a wsgi server.

Btw I refer to waitress because I want to run my app on Windows too.
Then can just use the build in web-server that come with Flask,it works fine on all OS.
Look at this post for a basic setup,so python app.py is starting the build in web-server.
E:\all_flask\2019\my_app
λ python app.py
 * Serving Flask app "app" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 334-187-997
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Reply
#20
(May-27-2019, 07:19 PM)snippsat Wrote:
(May-27-2019, 06:36 PM)Skaperen Wrote: s a HTTP to API interfacer. if i got that right,
Look at Full Stack Python WSGI Servers for more info.
i have already read that page. it came close to revealing what i wanted to know. i guess i will have to read the PEPs. PEPs tend to be hard to read.

(May-27-2019, 07:19 PM)snippsat Wrote:
Quote:then i still need to learn it, eventually, to do web development (as opposed to using an existing framework).
Using WSGI directly for web-development is not a pleasant thing,people who want to create yet another Python web-framework most read the WSGI specification.
There is no need at all for user that want to do web-development in Python,to read the WSGI doc.
a lot of things in C are not pleasant, but i have done them. i'm not the typical programmer. i learned assembly language a decade before i learned C. maybe, i won't find WSGI difficult. but i'll have to see it or try it to know for sure.


(May-27-2019, 07:19 PM)snippsat Wrote: Look at Werkzeug it's a thinner layer over WSGI.
Quote:Werkzeug is a comprehensive WSGI web application library.
It began as a simple collection of various utilities for WSGI applications,
and has become one of the most advanced WSGI utility libraries.

From Werkzeug came Flask same Author Armin Ronacher now under Pallets Projects with more developer that keep stuff updated.
With Flask work close to HTML/CSS/JavaScript with very little over head,it's very pleasant to do web-development in.
Django is also good,but it's has an other model that Flask with a lot stuff build in even if need it or not.
i did find Django confusing. i tend to be confuse by abstraction when i start from the abstract side. if i start from the concrete side, i can better understand what is going on.
Tradition is peer pressure from dead people

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


Possibly Related Threads…
Thread Author Replies Views Last Post
  python packaging/ hosted in IIS server manjureka 0 179 Apr-16-2024, 10:43 AM
Last Post: manjureka
  Script does not work on Linux server scrapemasta 0 269 Mar-22-2024, 11:07 AM
Last Post: scrapemasta
  Using a Proxy Server rsherry8 12 24,951 Dec-04-2023, 06:35 PM
Last Post: AlluminumFoil
  Server Error with parse_args() using Flask NoNameoN 0 1,104 Jul-30-2022, 09:42 AM
Last Post: NoNameoN
  [split] flask 500 internal server error DarthTensor 3 4,044 Nov-11-2021, 06:10 AM
Last Post: DarthTensor
  deploying python script on a server rickyrt 0 1,478 Aug-31-2021, 04:03 PM
Last Post: rickyrt
Question Flask, Self-hosted deployment, which server ? SpongeB0B 1 3,050 Apr-11-2021, 11:29 AM
Last Post: snippsat
  Connecting to a web server with authentification arbiel 0 1,596 Feb-02-2021, 08:31 PM
Last Post: arbiel
Question Telegram bot - Problem with proxies and web server NoNameoN 1 3,152 Oct-16-2020, 05:37 PM
Last Post: NoNameoN
  how to run a Python programm on a web server? gtlhbkkj 2 1,984 Aug-10-2020, 12:44 PM
Last Post: abusalim

Forum Jump:

User Panel Messages

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