Posts: 4,647
Threads: 1,494
Joined: Sep 2016
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.
Posts: 606
Threads: 3
Joined: Nov 2016
May-27-2019, 07:43 AM
(This post was last modified: May-27-2019, 07:44 AM by heiner55.)
I know CGI is bad, but if users want to have it.
Posts: 4,647
Threads: 1,494
Joined: Sep 2016
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.
Posts: 606
Threads: 3
Joined: Nov 2016
Posts: 7,320
Threads: 123
Joined: Sep 2016
May-27-2019, 11:02 AM
(This post was last modified: May-27-2019, 11:27 AM by snippsat.)
(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.
Posts: 4,647
Threads: 1,494
Joined: Sep 2016
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.
Posts: 7,320
Threads: 123
Joined: Sep 2016
(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.
Posts: 10
Threads: 4
Joined: Apr 2019
May-27-2019, 07:35 PM
(This post was last modified: May-27-2019, 07:35 PM by chrisdb.)
(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.
Posts: 7,320
Threads: 123
Joined: Sep 2016
May-27-2019, 08:31 PM
(This post was last modified: May-27-2019, 08:31 PM by snippsat.)
(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)
Posts: 4,647
Threads: 1,494
Joined: Sep 2016
(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.
|