Python Forum
Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WSGI vs CGI
#1
is WSGI an improved CGI-like interface?
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
(May-29-2017, 06:50 AM)Skaperen Wrote: is WSGI an improved CGI-like interface?
Guess you can call WSGI and very much improved CGI.
WSGI(is all written in Python),it's what saved Python when it comes to web-development.
All that worked with web knew that CGI could not be a modern solution for Python.
They first layout was in 2003(pep-333) and later in pep-3333.
Reply
#3
there is mod-wsgi for apache.  what does it provide?  just the advance over CGI?

do i really need a framework?  what does a framework provide for me?  i have built websites w/o a framework before (some with CGI in C and/or bash, some with PHP, some just plain static).  i have done one in Python using my own web server in Python (non-WSGI).  i wonder what it would take to make my web server be WSGI compliant.

my web server can be seen here.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#4
Quote:there is mod-wsgi for apache.  what does it provide?  just the advance over CGI?
One way to to run WSGI,
but i think Gunicorn with Ngnix is a better solution and what i always use.
Gunicorn allows to run any WSGI application with easy setup and scale easily.
Nginx faster lower memory usage,and is an asynchronous web server.
Quote:do i really need a framework?  what does a framework provide for me?
Yes,as example a framework like Flask give you a lot more than you can think of,and are 100% WSGI 1.0 compliant.
Doing web-development directly with WSGI is very unpleasant.
Flask has underlying libraries like  Werkzeug and Jinja2.
There is a lot of work that has gone into this.
Quote:i wonder what it would take to make my web server be WSGI compliant.
You most know all WSGI specification very good,
Armin Ronacher's(Author Flask) did work with this topic for many year first trough Werkzeug and Jinja,
then did write Flask in 2009.
Reply
#5
(May-31-2017, 02:19 AM)Skaperen Wrote: do i really need a framework?  what does a framework provide for me?
WSGI/CGI seems more like extensions. For example this server is LAMP and MyBB Forums is PHP, and adding a single additional page on it via Flask is not really probable. It seems like overkill (if its even possible). At least that is what i get from using it for a single page or two. WSGI/CGI is more easy at extending a page out on python than Flask on this server. Like this is Python CGI believe it or not. Its routed through PHP to give MYBB header and to restrict non-members access. Its not the whole site, just an extension. However if your whole site is python (like for example if your forums was python) then you most likely wouldnt create a LAMP server with pages created via WSGI/CGI...you would use a framework like Flask or Django.
Recommended Tutorials:
Reply
#6
what do i actually get out of a framework?

Quote:Yes,as example a framework like Flask give you a lot more than you can think of

such as?

Quote:Doing web-development directly with WSGI is very unpleasant.

BTDT

to make use of a framework, i'm going to need to know what to do different than the old way.

i'd like to see a list for each framework software.  are they all the same?

i apparently didn't need a framework before.  why do i need one now?  if it can offer improvements, then how?  i really need to know specifics to decide:  {0: 'no framework', 1: 'framework one', 2: 'framework two', ... }.
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
(Jun-01-2017, 01:17 AM)Skaperen Wrote: i'm going to need to know what to do different than the old way.
read a tutorial on whatever framework you decide to use.
(Jun-01-2017, 01:17 AM)Skaperen Wrote: i apparently didn't need a framework before.  why do i need one now?  if it can offer improvements, then how?
Its the same as why we use requests module instead of using urllib, or why we use python at all instead of C. Things are built in and we dont have to reinvent the wheel. sure you can build anything with WSGI but you are going to have to build things that Django/Flask has built in. http://python-guide-pt-br.readthedocs.io...arios/web/
Recommended Tutorials:
Reply
#8
(Jun-01-2017, 01:49 AM)metulburr Wrote: read a tutorial on whatever framework you decide to use.

at this point my decision is to not use a framework at all.  a means to run a Python script to serve a request is really all i need.

a test goal is to re-implement the server side of linuxhomepage.com in Python.  it is currently in PHP and has no framework.  i am working on trying to get mod-wsgi working under apache.  i installed package 'libapache2-mod-wsgi-py3' under Ubuntu 14.04.  i have it loaded on my apache server now and it did not kill anything.

(Jun-01-2017, 01:49 AM)metulburr Wrote: Its the same as why we use requests module instead of using urllib, or why we use python at all instead of C. Things are built in and we dont have to reinvent the wheel. sure you can build anything with WSGI but you are going to have to build things that Django/Flask has built in. http://python-guide-pt-br.readthedocs.io...arios/web/
that page does not list anything that seems useful to me.

i am expecting to write some modules and functions/methods to reuse stuff i do.

i will try to get the real-life WSGI examples working then from that work on making the new linuxhomepage.com.  then after that, with it implemented in Python instead of PHP, i will see what i can do to improve on it.  i think that will be easier in Python. i'll then see what might help and search if a framework offers that.
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
In the beginning was cgi, then wsgi. Well, the web frameworks are on the stage now. This is evolution. If the wsgi was the ultimate solutions, no one would try to create something like zope, flask, django and so on. All the hard work is done by someone else so now is easier for us to get the same as a result.

It looks like you want to have a hot water to deal with the dirty dishes by boiling a water in the backyard on open fire. But you have to take it to the kitchen after that. It's not an easy task and could be risky. You will attach some pipes to the boiler, some isolation. Finally, you will end with something that you already have. A hot water right from the wall.

Eventually, you will end with a web framework.

If all you need is just to serve a request you don't even need a web server like Apache. Just use sockets. Asyncio sockets

By the way, you may see bottle.py. It is a 'micro framework' and is a single file. Look at how is done. I may do it too. I am a little curios
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#10
(Jun-01-2017, 05:04 AM)wavic Wrote: In the beginning was cgi, then wsgi. Well, the web frameworks are on the stage now. This is evolution. If the wsgi was the ultimate solutions, no one would try to create something like zope, flask, django and so on. All the hard work is done by someone else so now is easier for us to get the same as a result.

It looks like you want to have a hot water to deal with the dirty dishes by boiling a water in the backyard on open fire. But you have to take it to the kitchen after that. It's not an easy task and could be risky. You will attach some pipes to the boiler, some isolation. Finally, you will end with something that you already have. A hot water right from the wall.

Eventually, you will end with a web framework.

If all you need is just to serve a request you don't even need a web server like Apache. Just use sockets. Asyncio sockets

By the way, you may see bottle.py. It is a 'micro framework' and is a single file. Look at how is done. I may do it too. I am a little curios
this all makes sense.  but i don't know if i need the framework now, or when i will need it in the future.  saying i can get hot water right from the wall so i don't have to trek through the mud outside, is detailed enough to tell me what kind of good thing i can have.  but i am still wanting to know enough specifics to change my 'no frameworks' decision.

so a framework is better. but is it 'for me', yet? i don't know.

FYI, where i live, we added broadband and wifi to our outhouses several years ago (running hot and cold water and electric heat and light were added decades ago).
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
  mod-wsgi in apache Skaperen 4 4,346 Jul-10-2017, 01:31 AM
Last Post: Skaperen
  mod-wsgi Skaperen 2 3,785 Jun-06-2017, 05:12 AM
Last Post: Skaperen
  WSGI working examples Skaperen 1 3,454 May-29-2017, 10:45 AM
Last Post: snippsat
  trying to figure out WSGI Skaperen 10 7,702 Apr-30-2017, 10:00 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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