Re: Python - requests - forms - web scraping - how to deal with multi stage forms

2018-05-17 Thread Grant Edwards
On 2018-05-17, kret...@gmail.com  wrote:

> https://stackoverflow.com/questions/50383210/python-requests-how-to-post-few-stages-forms

Your point?

-- 
Grant Edwards   grant.b.edwardsYow! I had pancake makeup
  at   for brunch!
  gmail.com

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python - requests - forms - web scraping - how to deal with multi stage forms

2018-05-17 Thread GMX

https://stackoverflow.com/questions/50383210/python-requests-how-to-post-few-stages-forms
 
-- 
https://mail.python.org/mailman/listinfo/python-list 


Hi, 

Your post will get more traction on the email list if you try to post the 
actual question on the list against posting a url to an external website for 
your question. 

Coming back to the question. I think what you want to do is implement some 
client side processing using Javascript or one of it’s frameworks and implement 
the parts. Once everything is done you can submit it to the python server. 

Hope that helps. 



Anubhav.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python loop and web server (bottle) in the same script (Posting On Python-List Prohibited)

2017-11-29 Thread zljubisic
Processing is I/O and CPU bound. :(
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python loop and web server (bottle) in the same script (Posting On Python-List Prohibited)

2017-11-24 Thread Gregory Ewing

Lawrence D’Oliveiro wrote:

I naturally concluded that you didn’t care about
updates being momentarily held up by a web request in progress--which would
happen anyway if you used threads, at least with CPython.


Not necessarily -- the web processing is probably I/O bound,
in which case the GIL will likely be released a lot of the time.

But if you want to be sure the GIL won't get in the way,
you would need to run the web and update tasks in separate
processes.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python loop and web server (bottle) in the same script (Posting On Python-List Prohibited)

2017-11-24 Thread zljubisic
That's right. Update task has precedence.
Looks like it is not an easy task.

Regards.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python loop and web server (bottle) in the same script (Posting On Python-List Prohibited)

2017-11-24 Thread Gregory Ewing

Lawrence D’Oliveiro wrote:

On Friday, November 24, 2017 at 3:27:17 AM UTC+13, zlju...@gmail.com wrote:


Looks like I need some sort of parallelization.


This is why coroutines were added to Python. Threading is notoriously 
bug-prone, and is best avoided in most situations.


The OP claimed that the timing of the update task is critical,
and needs to take priority over serving web pages. Coroutines
won't be able to achieve that.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python loop and web server (bottle) in the same script

2017-11-23 Thread Chris Angelico
On Fri, Nov 24, 2017 at 1:27 AM,   wrote:
> I would like to have a script that collects data every minute and at the same 
> time serve newly collected data as web pages.
>
> Timely collecting data is more important than serving web pages, so 
> collecting data should have priority and should never be interrupted by 
> serving web pages.
>
> Looks like I need some sort of parallelization.

Sounds like you want threads. Spin off a thread that collects data and
sleeps, collects data and sleeps; meanwhile, serve web pages. But
there's no way you can *guarantee* that the serving of pages won't
interrupt data collection. With separate processes, you could
potentially use OS-level prioritization to help your data collection
process, but even then, it's not a guarantee. What are the
consequences of mistimed data collection?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python scripts for web

2012-10-23 Thread chip9munk
On Friday, October 19, 2012 12:32:48 PM UTC+2, Gilles wrote:
 In that case, are you sure a web script is a good idea? If you're
 thinking web to make it easy for people to upload data, click on a
 button, and get the results back, you might want to write the UI in
 Python but write the number crunching part in a compiled language.

well actually I would like to separate the web interface with this API...
that is why I would like to work on the server side and not think about the 
interface side.



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python scripts for web

2012-10-19 Thread chip9munk
On Thursday, October 18, 2012 11:10:45 PM UTC+2, Zero Piraeus wrote:
 WSGI would enable you to write a persistent application that sits
 around waiting for requests and returns responses for them as and
 when, as opposed to a simple CGI script that gets started each time a
 request comes in, and terminates once it's returned the response.

ok I see, you have made it very clear for me now!
 
 So it's really about startup time - if your scripts are just doing
 something simple and quick, WSGI is likely overkill.

these scripts will do a lot of calculation on a big dataset, and it is possible 
that there will be many requests in a short period of time.
So I guess the WSGI is a better solution.

Thank you and the others very much, you have saved me a lot of time!

Cheers! 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python scripts for web

2012-10-19 Thread Gilles
On Thu, 18 Oct 2012 23:05:48 -0700 (PDT), chip9m...@gmail.com wrote:
these scripts will do a lot of calculation on a big dataset, and it is 
possible that there will be many requests in a short period of time.

In that case, are you sure a web script is a good idea? If you're
thinking web to make it easy for people to upload data, click on a
button, and get the results back, you might want to write the UI in
Python but write the number crunching part in a compiled language.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python scripts for web

2012-10-18 Thread Zero Piraeus
:

On 18 October 2012 03:18,  chip9m...@gmail.com wrote:
 Here is what I need to do: on some webpage (done in php, or any other
 different technology), user inputs some data, that data and the
 request then goes to the server where python scripts calculate
 something and return the result to the users end.

 Now, how do I do that server part, listening to requests, and calling
 python scripts?

If I understand you correctly, what you're describing here is a
webserver - i.e. Apache, nginx etc. I'm not sure why you'd want to
write one of those if you're as inexperienced as you say.

 I googled about that but I do not understand if I should do that by
 CGI, Flask, mod_wsgi, or any other way... I know to little about that
 to understand what is the way to go. :/

These are all approaches to writing the software that the webserver
hands the request off to, which is a different thing. If that's what
you really meant to ask (how to write a script that processes a
request and returns a response), then plain CGI might be the best
place to start, if you're trying to get a handle on what's going on.

Once you're happy that you understand how to build a plain CGI script,
frameworks [like Flask] can be very useful ... and Flask is both
lightweight and has good documentation, so it's not a bad choice for
learning purposes.

 -[]z.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python scripts for web

2012-10-18 Thread chip9munk
To explain, I am basically doing different algorithms and would like to make 
them work and be accessible as I mentioned in the example... and to add them to 
the functionality of a specific page... so I have experience in programming, 
just no experience in web development etc.. 

On Thursday, October 18, 2012 9:57:58 AM UTC+2, Zero Piraeus wrote:
 
 If I understand you correctly, what you're describing here is a
 webserver - i.e. Apache, nginx etc. I'm not sure why you'd want to
 write one of those if you're as inexperienced as you say.
 These are all approaches to writing the software that the webserver
 hands the request off to, which is a different thing. If that's what
 you really meant to ask (how to write a script that processes a
 request and returns a response), then plain CGI might be the best
 place to start, if you're trying to get a handle on what's going on.

I understand how the lack of knowledge on my part can cause the unclarity of my 
question.
I will give you an example. So let us say I create two simple python scripts, 
one does the sum of two numbers
the other one does the multiplication. SO now I want to put these scripts on 
the server. Now let us say there is a web page that would like to use these 
scripts (do this calculation). How do I do a program that will listen for the 
requests
from the web page and call the scripts on the request?  
 
 Once you're happy that you understand how to build a plain CGI script,
 frameworks [like Flask] can be very useful ... and Flask is both
 lightweight and has good documentation, so it's not a bad choice for
 learning purposes.

all the tutorials about flask are dealing wit creating the whole webpage in 
python. I do not need to do that, I just need a service on the servers end.. is 
flask still the way to go? Also flask does not support Python 3.x jet, would 
using cherryPy be a good idea?

Thank you for the answers! 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python scripts for web

2012-10-18 Thread Zero Piraeus
:

On 18 October 2012 04:10,  chip9m...@gmail.com wrote:
 I will give you an example. So let us say I create two simple python
 scripts, one does the sum of two numbers
 the other one does the multiplication. SO now I want to put these
 scripts on the server. Now let us say there is a web page that would
 like to use these scripts (do this calculation). How do I do a
 program that will listen for the requests
 from the web page and call the scripts on the request?

That is exactly what a webserver does. Is there some reason you don't
want to use e.g. Apache to handle the requests?

 -[]z.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python scripts for web

2012-10-18 Thread chip9munk
On Thursday, October 18, 2012 10:42:56 AM UTC+2, Zero Piraeus wrote:
 That is exactly what a webserver does. Is there some reason you don't
 want to use e.g. Apache to handle the requests?

no reason at all. so i guess the solution is much easier then I have 
anticipated.
So i guess in that case i do not need cgi or anything?

Thank you for clearing that out!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python scripts for web

2012-10-18 Thread Zero Piraeus
:

On 18 October 2012 05:22,  chip9m...@gmail.com wrote:
 So i guess in that case i do not need cgi or anything?

Assuming your scripts accept the request as sent and return an
appropriate response, they are CGI scripts (unless there's some
wrinkle in the precise definition of CGI that escapes me right now).

 Thank you for clearing that out!

No bother :-)

By the way: are you using Google Groups? It's just that I'm led to
understand that it's recently started to misbehave [more than it used
to], and your replies are addressed to both
comp.lang.pyt...@googlegroups.com and python-list@python.org,
which is redundant.

Or perhaps it always did that, and I've never noticed before ...

 -[]z.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python scripts for web

2012-10-18 Thread Chris Angelico
On Thu, Oct 18, 2012 at 8:22 PM,  chip9m...@gmail.com wrote:
 On Thursday, October 18, 2012 10:42:56 AM UTC+2, Zero Piraeus wrote:
 That is exactly what a webserver does. Is there some reason you don't
 want to use e.g. Apache to handle the requests?

 no reason at all. so i guess the solution is much easier then I have 
 anticipated.
 So i guess in that case i do not need cgi or anything?

 Thank you for clearing that out!

CGI is a protocol between Apache and your script. What you want to do
is set up Apache to call your CGI scripts.

BTW, you don't need to send to both comp.lang.python and python-list -
they mirror each other.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python scripts for web

2012-10-18 Thread rurpy
On 10/18/2012 04:02 AM, Zero Piraeus wrote: On 18 October 2012 05:22,  
chip9m...@gmail.com wrote:
[...]
 By the way: are you using Google Groups? It's just that I'm led to
 understand that it's recently started to misbehave [more than it used
 to], and your replies are addressed to both
 comp.lang.pyt...@googlegroups.com and python-list@python.org,
 which is redundant.

When you post from Google Groups you will sometimes
see a checkbox above the edit window that is a cc to
the python mailing list (python-list@python.org) 
which is checked by default.  

If you uncheck that, you'll stop the double posting.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python scripts for web

2012-10-18 Thread chip9munk
thank you for the answer!

On Thursday, October 18, 2012 12:03:02 PM UTC+2, Chris Angelico wrote:
 CGI is a protocol between Apache and your script. What you want to do
 is set up Apache to call your CGI scripts.



yes, but as I have just answered to Zero, is using mod_wsgi a better strategy?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python scripts for web

2012-10-18 Thread chip9munk
On Thursday, October 18, 2012 12:02:40 PM UTC+2, Zero Piraeus wrote:

 Assuming your scripts accept the request as sent and return an
 appropriate response, they are CGI scripts (unless there's some
 wrinkle in the precise definition of CGI that escapes me right now).

yes, they are, but, I came under the impression that it is not the most 
elegant/fast way to do it... shouldn't the mod_wsgi be a better strategy?
or am i mixing these therms?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python scripts for web

2012-10-18 Thread chip9munk
thank you guys for pointing the double posting issue out, I am having some 
issues with the news server i am using, so I am doing this via google.groups at 
the time! :)

i think i managed to fix it
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python scripts for web

2012-10-18 Thread Zero Piraeus
:

On 18 October 2012 12:03,  chip9m...@gmail.com wrote:
 yes, but as I have just answered to Zero, is using mod_wsgi a better strategy?

WSGI would enable you to write a persistent application that sits
around waiting for requests and returns responses for them as and
when, as opposed to a simple CGI script that gets started each time a
request comes in, and terminates once it's returned the response.

So it's really about startup time - if your scripts are just doing
something simple and quick, WSGI is likely overkill.

 -[]z.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-09-03 Thread Bruno Desthuilliers

Ed Singleton a écrit :

On Aug 26, 4:17 am, alex23 wuwe...@gmail.com wrote:

Frameworks created for the sake of creating a framework, as opposed to
those written to meet a defined need, tend to be the worst examples of
masturbatory coding.


Indeed, but masturbation is perfectly healthy and acceptable, and we
all do it every now and then.  It is however, much like the framework
in question, best kept private and not made public.



+1 QOTW !-)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-09-03 Thread Bruno Desthuilliers

John Nagle a écrit :
(snip)
MySQLdb is available only up to Python 2.5.  


Huh ???


Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type help, copyright, credits or license for more information.
 import MySQLdb
/var/lib/python-support/python2.6/MySQLdb/__init__.py:34: 
DeprecationWarning: the sets module is deprecated

  from sets import ImmutableSet
 cnx = MySQLdb.connect(db='cress', user='cress', passwd='cress')
 cursor = cnx.cursor()
 cursor.execute(SELECT id_article, titre FROM spip_articles)
28L
 for row in cursor:
... print row
...
(1L, '01. Sensibilisation')
(2L, '02. Gestation')
(3L, '03. Lancement')
(4L, '04. D\xe9veloppement')
(5L, '01. Sensibilisation')
(6L, '02. Gestation')
(7L, '03. Lancement')
(8L, '04. D\xe9veloppement')
(9L, '01. Sensibilisation')
(10L, '02. Gestation')
(11L, '03. Lancement')
(12L, '04. D\xe9veloppement')
(13L, 'Nouvel article')
(14L, 'Nouvel article')
(15L, '01. Les principes fondateurs d\x92une coop\xe9rative')
(16L, '02. C\x92est quoi une COOPERATIVE ?')
(17L, '10. Les principes fondamentaux de l\x92Economie sociale et 
solidaire')

(18L, '20. Les familles de l\x92Economie sociale et solidaire ')
(19L, 'Article 1')
(20L, 'Article 2')
(21L, 'Article 3')
(22L, 'Article 4')
(23L, 'Article 5')
(24L, 'Lancement du nouveau site de la CRESS')
(25L, 'Mise \xe0 jour des Formations')
(26L, La CRESS au Salon de l'Emploi)
(27L, '01. Pr\xe9sentation')
(28L, '20. Les formations universitaires BAC +3')
 cursor.close()
 cnx.close()


Seems to work just fine here...
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-09-02 Thread Ed Singleton
On Aug 26, 4:17 am, alex23 wuwe...@gmail.com wrote:
 Frameworks created for the sake of creating a framework, as opposed to
 those written to meet a defined need, tend to be the worst examples of
 masturbatory coding.

Indeed, but masturbation is perfectly healthy and acceptable, and we
all do it every now and then.  It is however, much like the framework
in question, best kept private and not made public.

Ed
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-28 Thread Bruno Desthuilliers

Phil a écrit :

 When
I gave that arbitrary percentage, I was basing it off of the
information I had seen with regards to launching applications built
with existing frameworks using lighttpd. I do realize I was missing a
lot of information by looking up something that specific.


Indeed !-)


I also
understand that there are enough frameworks. That still won't change
my mind. I do not want to write a web application, otherwise I would
use an existing framework as suggested. I just wanted to experiment
and see what kind of framework I could develop with some ideas I had
in mind.


I wrote quite a couple web and non web frameworks myself - all ending up 
 in the trash can FWIW, but it certainly has been a very educative 
experience by itself.



 I just really like some of the new features of
Python 3, and most importantly, unicode compliance is just that much
straight forward in my opinion.


If you're only writing your framework for learning purposes, you could 
as well go with Python 3, and implement everything from the ground up 
(not a trivial task FWIW).

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-28 Thread John Nagle

Graham Dumpleton wrote:

A few additional comments on top of what others have said.

On Aug 26, 11:09 am, Phil phil...@gmail.com wrote:

As I've read elsewhere, These days, FastCGI is never used directly.


Actually, FCGI works quite well.  Sitetruth's AdRater
(http://www.sitetruth.com/downloads/adrater.html) uses
FCGI and Python on the server.

FCGI is basically CGI with process reusability. Each
app gets its own process in its own address space with its
own global interpreter lock.  mod_fcgi in Apache keeps a
supply of such processes around, launching additional ones if there's
heavy request traffic and shutting down existing ones when there
isn't.  Each process handles one transaction after another,
so, unlike CGI, you're not spending all your time loading Python
and its modules.

Here's the main loop of a real FCGI application.  This uses a small
WSGI library on the Python side.  No framework is involved.


#!/usr/local/bin/python
...
from fcgi import WSGIServer
import MySQLdb
db = None   # database connection, held open for life of FCGI
#
#   The application
#
def QuickSitetruthQuery(environ, start_response):
global db   # static global - active database handle
try:
if db : # if previously attached
try :
db.ping() # test whether connection is still up
# handle loss of database connection
except MySQLdb.OperationalError, message:   
db = None # we lost database connection
if db is None : # if no valid database handle
db = miscutils.dbattach(kdbfile)# connect to database
status = '200 OK'   # normal status
headers = [('Content-type','text/xml'), ('charset','utf-8')]
reqlist = cgi.parse_qsl(environ['QUERY_STRING'])# Parse params
priority = 1# priority of request
sourceip = environ['REMOTE_ADDR']   # get IP address of client
urls = []   # list of URLs to check
for item in reqlist :   # for all items
(key, value) = item # extract item
if key.lower() == 'url' :   # want all url items
urls.append(value)
elif key.lower() == 'priority' :# if priority
priority = int(value)   # get priority value
#   Make request; no waiting, no details
outstr = InfoDisplay.getratingXMLquick(db, kdbfile, urls,
priority, sourceip) # get the rating XML, never wait
start_response(status, headers) # compose result
s = kprefixxml + outstr + ksuffixxml# construct output XML
return [s.encode('utf8')]   # encode as UTF8
except Exception, message:  # if trouble, report to user
#   Error handling
status = 500 Internal Error on Server
response_headers = [(Content-type,text/html)]
start_response(status, response_headers)
s = h1Internal error - request not processed./h1\n\n
+ traceback.format_exc()
s = s.replace(\n,br)# convert to HTML
return [s]
#
#   Main FCGI program
#
WSGIServer(QuickSitetruthQuery).run()


--
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-28 Thread John Nagle

Bruno Desthuilliers wrote:
If you're only writing your framework for learning purposes, you could 
as well go with Python 3, and implement everything from the ground up 
(not a trivial task FWIW).


   Python 3 isn't ready for prime time on web servers.  Too many major modules,
haven't been ported yet.  Twisted and Django are now available up to Python 2.6; 
MySQLdb is available only up to Python 2.5.  So the basics for web work aren't

ready yet.

   Python 2.5 is more or less the stable version of Python for production
use at the moment.  2.6 is a transition version to 3.0.

John Nagle
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-28 Thread Bruno Desthuilliers
John Nagle a écrit :
 Bruno Desthuilliers wrote:
 If you're only writing your framework for learning purposes, you could
 as well go with Python 3, and implement everything from the ground up
 (not a trivial task FWIW).
 
Python 3 isn't ready for prime time on web servers.  Too many major
 modules,
 haven't been ported yet.

Which ones (sorry, still using 2.5 at work so I didn't bother that much
with 2.6 so far) ?

 MySQLdb is available only up to Python 2.5.  So the basics
 for web work aren't
 ready yet.

I wouldn't label MySQLdb as a basic for web work - I mean, something
you just can't do without !-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-27 Thread Graham Dumpleton
On Aug 27, 1:02 pm, Phil phil...@gmail.com wrote:
 Thanks a lot for another response. I've never posted in groups like
 this before but the results are amazing.

 I will definitely consider trying mod_wsgi when I get a chance. I like
 the approach taken with it. It is unfortunate that I completely missed
 all Apache related material because I was using lighttpd. Is there no
 mod_wsgi for lighttpd? I guess I could always just Google that myself.

There is no mod_wsgi for lighttpd and suggest there never will be.
WSGI doesn't lend itself to working on top of an event driven system.
Someone did get a mod_wsgi going on nginx, which is also event driven,
but it has limitations due to possibility of blocking other traffic to
web server. See:

  http://blog.dscpl.com.au/2009/05/blocking-requests-and-nginx-version-of.html

Graham
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-27 Thread Bruno Desthuilliers

Phil a écrit :
(snip)

However, 99.9% of the discussion I see with Python on
the web is around FCGI.


May I suggest you spend some time reading django-users and django-dev on 
google groups ? (and that's only *one* of the way-too-many Python web 
frameworks).

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-27 Thread Phil
Thanks Graham. I actually ended up reading that blog post from a
Google search last night before I saw your response. It was very
informative.

Bruno, I will take a look at those groups to expand my knowledge. When
I gave that arbitrary percentage, I was basing it off of the
information I had seen with regards to launching applications built
with existing frameworks using lighttpd. I do realize I was missing a
lot of information by looking up something that specific. I also
understand that there are enough frameworks. That still won't change
my mind. I do not want to write a web application, otherwise I would
use an existing framework as suggested. I just wanted to experiment
and see what kind of framework I could develop with some ideas I had
in mind. The original post was mostly just because I was having a
difficulty understanding some lower level concepts as a result of
trying to get Python 3 on the web before figuring out that it wasn't
quite ready for that. I just really like some of the new features of
Python 3, and most importantly, unicode compliance is just that much
straight forward in my opinion.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-27 Thread Aahz
In article d2921dc3-646c-49f3-8dd6-228bbc649...@k30g2000yqf.googlegroups.com,
Phil  phil...@gmail.com wrote:

My interest in Python 3.1 was actually to develop a framework. Again,
I can feel the flames. :) I understand there are enough frameworks but
I actually have no applications that I wish to develop. I enjoy
developing these kinds of things from scratch as a learning
experience.

Well, there's a standard joke that just as people learning Scheme write
a new language (following SICP), people learning Python write a new web
framework.  That's why there are so many of them.
-- 
Aahz (a...@pythoncraft.com)   * http://www.pythoncraft.com/

I support family values -- Addams family values --www.nancybuttons.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-27 Thread Phil
Haha. While I don't disagree with you, I seem to be under the
impression that you think I haven't been reading the web where nearly
every blog post complains about the abundance of Python frameworks.
The thing is, most of the frameworks being commented on in such a way
are 'microframeworks' that provide next to nothing. I'm do not mean to
say anything negative about them, but I strongly feel that my approach
will be much more functional without having to include, or at least a
good starting point for newcomers to both Python and web programming.
The ideas I had for mine lied somewhere in between a full stack
framework and a minimalist approach like said microframeworks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-26 Thread Bruno Desthuilliers

Phil a écrit :

I've seen lots of web sites explaining everything, but for whatever
reason I seem to not be picking something up.
I am a graphical person, which is probably the reason I haven't found
my answer.
May somebody please confirm if my diagram accurately represents the
stack, generally speaking.

http://i26.tinypic.com/1fe82x.png


Seems correct.


Even if that is the case, I'm having a hard time understanding the
differences. I guess wsgiref has absolutely nothing to do with FCGI/
SCGI/CGI and simply receives and responds to HTTP requests following
the WSGI specification?


Yeps.


Does it just spawn a new thread for each
request?


Not AFAICT.



The way I am understanding the 'Production' side of that picture is
that the web server (eg. lighttpd) creates a single FCGI process. The
FCGI process is actually the entry point of the Framework/Application
which sets up Flup's WSGIServer, being the interface between FCGI and
the Framework/Application? What I mean is, it is just the code that
the web server loads to start with, example...
from flup.server.fcgi import WSGIServer
from app import application
WSGIServer(application).run()
... Then for each HTTP request, Flup's WSGIServer creates a new thread
to handle the request?


I didn't bother reading Flup's source code, but I suppose this might be 
the case.



As I've read elsewhere, These days, FastCGI is never used directly.
Just like mod_python it is only used for the deployment of WSGI
applications. As far as I understand, the main (or only?) reasoning
for this is because WSGI makes Python applications easier to deploy
without having to worry about whether using FCGI/SCGI/CGI.


Nor about which web server you use (Apache, lighthttpd, whatever).


What would be involved to run Python on the web using FCGI without
WSGI? I can feel the flames already. This isn't the only reason I want
to know, but one reason is that I want to use Python 3.1 and as I
understand, this will have to wait for the WSGI 2.0 specification to
ensure time isn't wasted.


My humble opinion (based on years of experience in both Python and web 
programming) is that you're taking the wrong approach. I can only second 
 Robert Kern here: use an existing, well maintained wsgi-compliant 
framework like Django, Pylons etc, and wait for the framework to be 
ported to python 3.x. Any other solution will almost certainly end up 
needing a complete rewrite anytime soon.



I apologize if the questions are ridiculous. I've just recently got
into web programming and it seems that in order for me to use Python,
I need a deep understanding of web servers, HTTP, FCGI, etc.


Programming for the web - whatever the language  techno - indeed 
require a deep (or at least correct) understanding of HTTP and web 
servers, yes. Even with the abstraction layers provided by frameworks, 
you still need to understand how the whole damn thing works, what's an 
HTTP resquest  response and quite a few other things as well.


--
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-26 Thread Phil
Thanks to everybody. I believe I am understanding things better.

I have looked at the links that have been provided, although I have
seen most of them in the past month or so that I've been looking into
this stuff. I do agree with most of the things Armin stated in that
NIH post. I agree with everybody in this thread so far. If I wanted to
write an application, I would use an existing framework and wait for
it to be ported to 3.x. However, I do not have the need to write a web
application at this time, and creating blogs or other applications I
do not need for fun is getting old.

My reasoning for working on my own instead of following the 'NIH'
concept or contributing to an existing framework is because I have
experimented with many existing frameworks and I have figured out what
I like/dislike, and have envisioned my own design that I feel would
work potentially better for others, or at least newcomers. Things like
this are fun for me, and I do not mind the challenge. I don't want to
pollute the web with (sigh) 'another framework', but it would be fun
for me to write it and get some feedback. I would love for people like
you, Armin, and others who take a look at the various frameworks that
pop up seemingly every day, to look at my (hypothetical) framework and
just rip it apart with (constructive) criticism. That is just the way
I do things, whether the community agrees with it or not. The reason I
was asking about Python 3 on the web was just because I like some of
the changes that have been made, and would like to use it for my
framework. That is when I realized that I was absolutely clueless
about the details of how Python, or any language, works on the web.

Graham, regarding number 3 in your list of ways to host WSGI: I
haven't really looked into mod_wsgi at all, but basically it sounds
like the web server would be running this embedded module. That module
would then serve the function of both FCGI and the 'WSGI Server' in my
diagram? That actually sounds really neat. Unfortunately I missed this
because I've been hooked on lighttpd, as the minimalist I am.

Here are the things I am still confused with:

1) Why do I not want to consider running Python on the web with FCGI,
without WSGI? You said 'no' straight up, no questions asked. I would
imagine that there is a good reason of course, as you've been in this
field for a long time. I just feel more comfortable understanding why.
From my understanding, the only real purpose of WSGI is to remain
independent of FCGI/SCGI/CGI/AJP (whatever that is) and the web server
it is run on. However, 99.9% of the discussion I see with Python on
the web is around FCGI. So for example, lets say everybody used FCGI.
All that would be left to deal with is web server independence. Now
this is what I don't get, I thought that FCGI itself was supposed to
be the protocol that deals with web server independence. Maybe I just
need to re-read entire WSGI specification to understand, along with
all the details of FCGI. There are just so many details regarding web
servers, FCGI, and WSGI that it is hard to absorb it all and see how
it works together. That is why I tried to create the diagram, but it
doesn't provide enough details. And those are the details I am
missing. I've been trying to find a simple diagram or explaination of
the process a request takes to make a response, from HTTP all the way
up to the application, to the the user.

2) In the development stack, the 'WSGI Server' seems to take on the
role of the web server (dealing with HTTP specification), skips FCGI,
and deals with the WSGI specification. Then, the 'WSGI Server' in the
production stack (eg. Flup, CherryPy, etc) only deals with FCGI and
WSGI specification, because the HTTP is already taken care of by the
web server?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-26 Thread Graham Dumpleton
On Aug 27, 2:54 am, Phil phil...@gmail.com wrote:
 Thanks to everybody. I believe I am understanding things better.

 I have looked at the links that have been provided, although I have
 seen most of them in the past month or so that I've been looking into
 this stuff. I do agree with most of the things Armin stated in that
 NIH post. I agree with everybody in this thread so far. If I wanted to
 write an application, I would use an existing framework and wait for
 it to be ported to 3.x. However, I do not have the need to write a web
 application at this time, and creating blogs or other applications I
 do not need for fun is getting old.

 My reasoning for working on my own instead of following the 'NIH'
 concept or contributing to an existing framework is because I have
 experimented with many existing frameworks and I have figured out what
 I like/dislike, and have envisioned my own design that I feel would
 work potentially better for others, or at least newcomers. Things like
 this are fun for me, and I do not mind the challenge. I don't want to
 pollute the web with (sigh) 'another framework', but it would be fun
 for me to write it and get some feedback. I would love for people like
 you, Armin, and others who take a look at the various frameworks that
 pop up seemingly every day, to look at my (hypothetical) framework and
 just rip it apart with (constructive) criticism. That is just the way
 I do things, whether the community agrees with it or not. The reason I
 was asking about Python 3 on the web was just because I like some of
 the changes that have been made, and would like to use it for my
 framework. That is when I realized that I was absolutely clueless
 about the details of how Python, or any language, works on the web.

 Graham, regarding number 3 in your list of ways to host WSGI: I
 haven't really looked into mod_wsgi at all, but basically it sounds
 like the web server would be running this embedded module. That module
 would then serve the function of both FCGI and the 'WSGI Server' in my
 diagram? That actually sounds really neat. Unfortunately I missed this
 because I've been hooked on lighttpd, as the minimalist I am.

 Here are the things I am still confused with:

 1) Why do I not want to consider running Python on the web with FCGI,
 without WSGI? You said 'no' straight up, no questions asked. I would
 imagine that there is a good reason of course, as you've been in this
 field for a long time.

Because FASTCGI is a wire protocol for socket communications and not a
programming interface. As such, you would only be creating much more
work for your self as you would need to implement a whole lot of code
to handle the protocol and then still put a usable interface on top of
it. You would also have to come up with what that usable interface
should be as well. WSGI already provides that low level interface.

 I just feel more comfortable understanding why.
 From my understanding, the only real purpose of WSGI is to remain
 independent of FCGI/SCGI/CGI/AJP (whatever that is) and the web server
 it is run on. However, 99.9% of the discussion I see with Python on
 the web is around FCGI.

99.9% of the discussion about Python on the web is not around FASTCGI.
Even if there is quite a bit of discussion, it is because
documentation on hosting Python on FASTCGI via flup is virtually non
existent and so many people have a lot of trouble getting it to work
due to peculiarities of different FASTCGI implementations. The
dicusssion is therefore because people have problems with it, or feel
the need to blog about how they finally got it to work. So, FASTCGI
may be the only way for commodity web hosting, but it certainly isn't
for self managed servers where mod_wsgi, mod_python and mod_proxy type
solutions are going to be preferred. The latter are better documented
or easier to setup and so why you possibly don't see as much
discussion. In other words, people who get things working easily don't
need to ask questions.

 So for example, lets say everybody used FCGI.
 All that would be left to deal with is web server independence. Now
 this is what I don't get, I thought that FCGI itself was supposed to
 be the protocol that deals with web server independence. Maybe I just
 need to re-read entire WSGI specification to understand, along with
 all the details of FCGI. There are just so many details regarding web
 servers, FCGI, and WSGI that it is hard to absorb it all and see how
 it works together. That is why I tried to create the diagram, but it
 doesn't provide enough details. And those are the details I am
 missing. I've been trying to find a simple diagram or explaination of
 the process a request takes to make a response, from HTTP all the way
 up to the application, to the the user.

FASTCGI fills a role, but is not essential. Personally I feel that
whole concept of FASTCGI/SCGI/AJP needs a refresh and modernised with
better hosting support for it.

 2) In the development stack, the 'WSGI 

Re: Python on the Web

2009-08-26 Thread Phil
Thanks a lot for another response. I've never posted in groups like
this before but the results are amazing.

I will definitely consider trying mod_wsgi when I get a chance. I like
the approach taken with it. It is unfortunate that I completely missed
all Apache related material because I was using lighttpd. Is there no
mod_wsgi for lighttpd? I guess I could always just Google that myself.

Thanks again for the help.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-25 Thread Robert Kern

On 2009-08-25 20:09 PM, Phil wrote:

I've seen lots of web sites explaining everything, but for whatever
reason I seem to not be picking something up.
I am a graphical person, which is probably the reason I haven't found
my answer.
May somebody please confirm if my diagram accurately represents the
stack, generally speaking.

http://i26.tinypic.com/1fe82x.png

Even if that is the case, I'm having a hard time understanding the
differences. I guess wsgiref has absolutely nothing to do with FCGI/
SCGI/CGI and simply receives and responds to HTTP requests following
the WSGI specification?


Correct.


Does it just spawn a new thread for each
request?


No, it is single-threaded.


If so, then how is this any different than a production
server with FCGI?

The way I am understanding the 'Production' side of that picture is
that the web server (eg. lighttpd) creates a single FCGI process. The
FCGI process is actually the entry point of the Framework/Application
which sets up Flup's WSGIServer, being the interface between FCGI and
the Framework/Application? What I mean is, it is just the code that
the web server loads to start with, example...
 from flup.server.fcgi import WSGIServer
 from app import application
 WSGIServer(application).run()
... Then for each HTTP request, Flup's WSGIServer creates a new thread
to handle the request?


Something like that, yes.


As I've read elsewhere, These days, FastCGI is never used directly.
Just like mod_python it is only used for the deployment of WSGI
applications. As far as I understand, the main (or only?) reasoning
for this is because WSGI makes Python applications easier to deploy
without having to worry about whether using FCGI/SCGI/CGI.


Yes, that is the primary reason for WSGI, in my mind. There are other things 
like the composability of applications, but the decoupling of application 
authoring from deployment is the sine qua non, in my opinion.



What would be involved to run Python on the web using FCGI without
WSGI? I can feel the flames already. This isn't the only reason I want
to know, but one reason is that I want to use Python 3.1 and as I
understand, this will have to wait for the WSGI 2.0 specification to
ensure time isn't wasted.


I am willing to bet that the FCGI libraries haven't been upgraded to Python 3.x, 
either. I suspect that the most 3.x-updating work will be going into WSGI and 
the adapters. E.g.


  http://www.saddi.com/software/news/archives/64-Dabbling-in-Python-3.0.html

You may want to rethink the Python 3.x requirement, though. It will probably be 
much less a waste of your time to write your app using a framework like Django 
or Pylons on Python 2.x and then upgrade to Python 3.x when they do.



I apologize if the questions are ridiculous. I've just recently got
into web programming and it seems that in order for me to use Python,
I need a deep understanding of web servers, HTTP, FCGI, etc. I have
more questions but they go more off topic, so I will save it for
another thread, another day.


Knowing something about HTTP will certainly help get into the right mindset to 
know what limitations and capabilities web apps can have.


Typically, though, you use a framework that abstracts most of this stuff away 
from you. You usually only need to delve into the details in very specific 
circumstances.


--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-25 Thread Phil
Thank you for the helpful and timely response.

My interest in Python 3.1 was actually to develop a framework. Again,
I can feel the flames. :) I understand there are enough frameworks but
I actually have no applications that I wish to develop. I enjoy
developing these kinds of things from scratch as a learning
experience.

I've been doing fine with 2.x and WSGI, even without understanding
half of this stuff. It is actually my first Python project. Haha. I
just have my own design philosophies that I wish to experiment with.
Python 3.x just makes everything nicer with UNICODE, etc.

Although you've been helpful with almost all of the mentioned
concerns, I am still looking for more details on some of the questions
I've asked. So, if others stumble upon this post, feel free to
contribute further.

Thanks again.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-25 Thread alex23
Phil phil...@gmail.com wrote:
 My interest in Python 3.1 was actually to develop a framework. Again,
 I can feel the flames. :) I understand there are enough frameworks but
 I actually have no applications that I wish to develop.

No offense intended, but that's probably the worst approach to take.

Frameworks created for the sake of creating a framework, as opposed to
those written to meet a defined need, tend to be the worst examples of
masturbatory coding.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-25 Thread Phil
On Aug 25, 11:17 pm, alex23 wuwe...@gmail.com wrote:
 Phil phil...@gmail.com wrote:
  My interest in Python 3.1 was actually to develop a framework. Again,
  I can feel the flames. :) I understand there are enough frameworks but
  I actually have no applications that I wish to develop.

 No offense intended, but that's probably the worst approach to take.

 Frameworks created for the sake of creating a framework, as opposed to
 those written to meet a defined need, tend to be the worst examples of
 masturbatory coding.

No offense taken. I understand your concern. I actually do have some
important design decisions I wish to meet. It has sort of been a
process of evaluating the things I love and hate most from existing
frameworks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-25 Thread Graham Dumpleton
On Aug 26, 1:17 pm, alex23 wuwe...@gmail.com wrote:
 Phil phil...@gmail.com wrote:
  My interest in Python 3.1 was actually to develop a framework. Again,
  I can feel the flames. :) I understand there are enough frameworks but
  I actually have no applications that I wish to develop.

 No offense intended, but that's probably the worst approach to take.

 Frameworks created for the sake of creating a framework, as opposed to
 those written to meet a defined need, tend to be the worst examples of
 masturbatory coding.

I would in part actually disagree with that.

The problem with people creating frameworks to meet some defined need
is that they often implement only just enough of that framework to
meet that need and nothing more. End result is that the framework is
more often than not ever fleshed out enough to be of much use to
anyone else. Its existence though just pollutes the Internet with more
crap that one has to wade through.

Since there is already a plethora of good frameworks out there, if
writing an application, you are better of using one of the existing
frameworks. If interested in working at the framework level, you would
still be much better off looking at the existing frameworks, first
learn how they work and then consider contributing to them, rather
than implementing your own.

For some related reading, see:

  http://lucumr.pocoo.org/2009/7/30/nih-in-the-wsgi-world

As far as low level framework (or anti frameworks), suggest looking at
Werkzeug, Paste/Pylons and bobo.

I'll comment more on original message later.

Graham
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the Web

2009-08-25 Thread Graham Dumpleton
A few additional comments on top of what others have said.

On Aug 26, 11:09 am, Phil phil...@gmail.com wrote:
 I've seen lots of web sites explaining everything, but for whatever
 reason I seem to not be picking something up.
 I am a graphical person, which is probably the reason I haven't found
 my answer.
 May somebody please confirm if my diagram accurately represents the
 stack, generally speaking.

 http://i26.tinypic.com/1fe82x.png

 Even if that is the case, I'm having a hard time understanding the
 differences. I guess wsgiref has absolutely nothing to do with FCGI/
 SCGI/CGI and simply receives and responds to HTTP requests following
 the WSGI specification?

Technically it receives and responses to request based on HTTP
specification, not WSGI specification. The underlying HTTP server
translates to and communicates with a Python web application using the
WSGI interface.

 Does it just spawn a new thread for each
 request? If so, then how is this any different than a production
 server with FCGI?

I would describe there as being four major ways that WSGI can be
hosted. These are:

1. Custom build HTTP/WSGI server written in Python. Production quality
examples are CherryPy WSGI server and Paste HTTP server. You shouldn't
use wsgiref for anything but very simple stuff.

2. Per request process execution by way of CGI and a CGI/WSGI adapter.
This could be under Apache or any other web server which supports CGI.

3. Module that embeds Python interpreter into a C based web server.
Example are mod_wsgi and mod_python for Apache. Note that mod_python
would infrequently be used to host WSGI and doesn't include its own
WSGI adapter. These days mod_wsgi for Apache would be used. Processes
in this would be persistent.

4. Module in a web server that allows one to communicate using a
custom protocol with a separate persistent web application process
hosting the web application through a WSGI interface. This convers
FASTCGI, SCGI and AJP. The mod_wsgi module for Apache has a hybrid
mode which work in a similar way but uses an  internal protocol.

Amongst these, there are many variations as far as number of process
and threads. For a bit of discussion about this in relation to
mod_wsgi read:

  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

 The way I am understanding the 'Production' side of that picture is
 that the web server (eg. lighttpd) creates a single FCGI process.

FASTCGI isn't restricted to a single process, nor single threading.
Whether a particular implementation allows for the variations depends
on the implementation.

 The
 FCGI process is actually the entry point of the Framework/Application
 which sets up Flup's WSGIServer, being the interface between FCGI and
 the Framework/Application? What I mean is, it is just the code that
 the web server loads to start with, example...
     from flup.server.fcgi import WSGIServer
     from app import application
     WSGIServer(application).run()
 ... Then for each HTTP request, Flup's WSGIServer creates a new thread
 to handle the request?

 As I've read elsewhere, These days, FastCGI is never used directly.

Even back in time, I don't think it was really ever used as a generic
interface that people worked with directly, there was always a more
usable layer built on top of it.

 Just like mod_python it is only used for the deployment of WSGI
 applications.

The mod_python module isn't used just for WSGI applications and is
probably rarely used for them. This is because mod_python has its own
interface for building web applications. It also has abilities to hook
into Apache request handling phases, meaning it can do more than host
a a content handler/web application.

 As far as I understand, the main (or only?) reasoning
 for this is because WSGI makes Python applications easier to deploy
 without having to worry about whether using FCGI/SCGI/CGI.

WSGI provides for portability, it isn't necessarily easier to use than
mod_python.

 What would be involved to run Python on the web using FCGI without
 WSGI? I can feel the flames already.

No, you really don't want to do that.

 This isn't the only reason I want
 to know, but one reason is that I want to use Python 3.1 and as I
 understand, this will have to wait for the WSGI 2.0 specification to
 ensure time isn't wasted.

Then look at mod_wsgi. It already has support for Python 3.X. Some
aspects of how it implements WSGI 1.0 may change, but will not be too
much and details are being sorted out in the back rooms as we speak.
See:

  http://code.google.com/p/modwsgi/wiki/ChangesInVersion0300

The other option is CherryPy WSGI server as that is close to a Python
3.X release as well, as I perceive it.

I wouldn't bother waiting for WSGI 2.0. That is more of a pipe dream.
There will be an updated WSGI 1.0 for Python 3.0.

Graham

 I apologize if the questions are ridiculous. I've just recently got
 into web programming and it seems that in order for me to use Python,
 I need a deep understanding 

Re: Python on the web, how to?

2009-08-18 Thread Chris Rebert
On Tue, Aug 18, 2009 at 4:06 PM, Atul.atulskulka...@gmail.com wrote:
 Hello All,

 Needless to say I am new to python and web programming. I am looking
 for a quick Python-101 course / tutorial for using python to
 implement dynamic content on web under some web server. Any pointers
 what should I be reading?

Google for Python web framework and take your pick.

Some popular choices:
- Django: http://www.djangoproject.com/
-- associated online book: http://djangobook.com/
- TurboGears: http://turbogears.org/

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the web - newby question

2008-09-03 Thread Bruno Desthuilliers

SimonPalmer a écrit :

Apologies in advance if this is either a) the wrong board or b) been
answered a million times elsewhere, but...

I have been given an assignment to get a python module up and running
behind an existing web site.  At the moment the rest of the site is
developed in PHP but the hosts have said they will provide python
support for free, although they haven't given any more details than
that, so I'm not sure exactly what that means.


Depending on the hosts, this can range from having an antiquated python 
version with only cgi enabled and no way to install anything to the very 
last stable release and (almost) whatever third-part lib / frameworks 
and correct configuration.



 All reasonably
encouraging though.

I'm a newbie to python but quite experienced with Java/J2EE/JBoss.


Quite another world...


What I need to know is how I get python running on the server


For which definition of 'server' ? The computer, or the web server process ?


and what
tools/middleware I would need to have installed on the host's machines
to be able to support my python modules.


Depends on your modules dependencies !-)

More seriously : Python is known has being the language with more web 
frameworks than keywords. IOW, there's no simple straightforward answer 
to your question. Fisrt choose which Python web development solution you 
intend to use, then read the FineManual's deployment section of the 
chosen solution.


You'll find pointers to most web-related libs / frameworks here:
http://wiki.python.org/moin/WebFrameworks
http://wiki.python.org/moin/WebProgramming

Given your situation (Python newcomer with a real job to do), and if 
your job is anything more than a very QD deadsimple task, I'd 
personnaly recommand Django (http://djangiproject.com). Don't let the 
version number fools you (latest version is 1.0 release candidate), 
Django is a mature, solid and proven solution that have years of 
existance, and what they call 1.0rc would be labeled at least 3.5 for 
some other software... It's also mostly documented, and there's a strong 
community around the framework, so you should not have much problem 
getting help.


For any other Python question (I mean, non django-related), you're at 
the right place.


Oh, and yes, if I may suggest a reading:
http://dirtsimple.org/2004/12/python-is-not-java.html

HTH, and welcome on board...
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python on the web - newby question

2008-09-03 Thread SimonPalmer
On Sep 3, 8:41 pm, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
 SimonPalmer a écrit :

  Apologies in advance if this is either a) the wrong board or b) been
  answered a million times elsewhere, but...

  I have been given an assignment to get a python module up and running
  behind an existing web site.  At the moment the rest of the site is
  developed in PHP but the hosts have said they will provide python
  support for free, although they haven't given any more details than
  that, so I'm not sure exactly what that means.

 Depending on the hosts, this can range from having an antiquated python
 version with only cgi enabled and no way to install anything to the very
 last stable release and (almost) whatever third-part lib / frameworks
 and correct configuration.

   All reasonably
  encouraging though.

  I'm a newbie to python but quite experienced with Java/J2EE/JBoss.

 Quite another world...

  What I need to know is how I get python running on the server

 For which definition of 'server' ? The computer, or the web server process ?

  and what
  tools/middleware I would need to have installed on the host's machines
  to be able to support my python modules.

 Depends on your modules dependencies !-)

 More seriously : Python is known has being the language with more web
 frameworks than keywords. IOW, there's no simple straightforward answer
 to your question. Fisrt choose which Python web development solution you
 intend to use, then read the FineManual's deployment section of the
 chosen solution.

 You'll find pointers to most web-related libs / frameworks 
 here:http://wiki.python.org/moin/WebFrameworkshttp://wiki.python.org/moin/WebProgramming

 Given your situation (Python newcomer with a real job to do), and if
 your job is anything more than a very QD deadsimple task, I'd
 personnaly recommand Django (http://djangiproject.com). Don't let the
 version number fools you (latest version is 1.0 release candidate),
 Django is a mature, solid and proven solution that have years of
 existance, and what they call 1.0rc would be labeled at least 3.5 for
 some other software... It's also mostly documented, and there's a strong
 community around the framework, so you should not have much problem
 getting help.

 For any other Python question (I mean, non django-related), you're at
 the right place.

 Oh, and yes, if I may suggest a 
 reading:http://dirtsimple.org/2004/12/python-is-not-java.html

 HTH, and welcome on board...

Hey, thanks very much this is really helpful.  What I really need is
pointers, I'm sure I can figure the rest out.  I am indeed a guy with
a real job to do.  Doesn't help that the client and host are on the
other side of the world.

I quite like python.  As a veteran coder who has tried a lot of
languages this has been a pleasant experience so far.  I *really* like
numpy and scipy.  My stock in trade is algorithms and they are quite a
revelation.  I wish I had known about them sooner and I think they
will keep me coming back to python regularly.

Thanks again.
SP
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python for the web

2008-06-10 Thread Daniel Fetchinson
 Hello,
 I have developed a python tool that basically does two things:
 1. Allow the user to search for a keyword or a group of Keywords in a
 specailized collection of text files.  This search option is part of a
 massive custom tree control that was developed using wxpython.
 2. The rest of the tree control is in the form of concepts (labels for
 the concepts) that the user chooses from to get some text displayed as well.

 I have been adviced to use AppEngine but do you think that as my application
 sends a lot of user requests to the server(to ask for some pieces of text to
 be displayed), using CGI will be too slow? Is there a better way of doing
 it? If you can advice me on which tools to use to develop my web page that
 will include a tree structure, I would be very grateful.

 Thank you very much in advance,
 Nora.

If you use the google appengine you probably won't have problems with
performance. Django [1] works with the appengine (as far as I know) so
you can build your app using that framework. If you don't insist on
the appengine you may want to check out turbogears [2] either the
stable version 1 [3] or the brand new but not yet released version 2
[4]. If you don't mind a steep learning curve there is zope [5] but
many tend to agree that for anything small to medium size it's an
overkill. If your app is really simple and any framework feels too
heavy weight you might just go ahead with plain CGI or fastCGI or use
mod_wsgi [6] directly assuming you use apache. The old mod_python [7]
module of apache is not very actively maintained and mod_wsgi is
favored over it but if what you do is a small in-house stuff nobody
will stop you from using it and it can actually be a good option.

[1] http://www.djangoproject.com/
[2] http://turbogears.org/
[3] http://docs.turbogears.org/1.0
[4] http://turbogears.org/2.0/docs/index.html
[5] http://zope.org/
[6] http://code.google.com/p/modwsgi/
[7] http://modpython.org/

Cheers,
Daniel
-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python Plugin for Web Browser

2006-12-12 Thread Sébastien Ramage
pour ceux que ça intéresse

http://base.google.com/base/a/1438658/D18001067256043490325

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Plugin for Web Browser

2006-12-06 Thread Sébastien Ramage
des exemples de plugins pour IE oui mais qui ne sont pas embarqué dans
une page Web
je souhaiterai créer qqchose qui ressemble vraiment à Java VM ou
Flash
J'ai trouvé un début de réponse pour Firefox en télécharger le
GeckoSDK
mais je n'arrive pas à compiler les exemples pour le moment...

merci


MC a écrit :

 Bonjour !

 Pour IE, il y a des exemples de plugins, fournis avec PyWin32.
 Pour FF (comme pour Opera), je ne sais pas.
 
 -- 
 @-salutations
 
 Michel Claveau

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python Plugin for Web Browser

2006-12-06 Thread Andre Meyer

Hi

I was looking for something similar in the past and could not find it. It
would be very useful to have Python applets in web pages. What would you use
them for?

kind regards
André



On 5 Dec 2006 23:59:29 -0800, Sébastien Ramage [EMAIL PROTECTED]
wrote:


des exemples de plugins pour IE oui mais qui ne sont pas embarqué dans
une page Web
je souhaiterai créer qqchose qui ressemble vraiment à Java VM ou
Flash
J'ai trouvé un début de réponse pour Firefox en télécharger le
GeckoSDK
mais je n'arrive pas à compiler les exemples pour le moment...

merci


MC a écrit :

 Bonjour !

 Pour IE, il y a des exemples de plugins, fournis avec PyWin32.
 Pour FF (comme pour Opera), je ne sais pas.

 --
 @-salutations

 Michel Claveau



--
http://mail.python.org/mailman/listinfo/python-list





--
Dr. Andre P. Meyerhttp://python.openspace.nl/meyer
TNO Defence, Security and Safety  http://www.tno.nl/
Delft Cooperation on Intelligent Systems  http://www.decis.nl/

Ah, this is obviously some strange usage of the word 'safe' that I wasn't
previously aware of. - Douglas Adams
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python Plugin for Web Browser

2006-12-06 Thread Andre Meyer

Hi Sebastien

Yes, I am a developer, but not C/C++. I have done Java (and many other
languages) in the past, but use Python nowadays.

So, I am no help for developing the plugin, sorry. I would want to use it
though for developing richer Web sites in Python, rather than in
JavaScript/Ajax. Having said that: maybe you are also interested in pyjamas
(http://pyjamas.pyworks.org/).

kind regards
André



On 12/6/06, Sebastien Ramage [EMAIL PROTECTED] wrote:


Hi

Thank you for your reply.
Yes ! It would be very useful and easy to develop (the applet not the
plugin) !

I don't have real project at this time but, I like Python and use it every
day. Many time I want to make an applet for game, or webcam remote control
but I don't understand and I don't want to learn Java when I know the
powerful python.
Are you a developper? C++ ?

Seb




2006/12/6, Andre Meyer [EMAIL PROTECTED]:

 Hi

 I was looking for something similar in the past and could not find it.
 It would be very useful to have Python applets in web pages. What would you
 use them for?

 kind regards
 André



 On 5 Dec 2006 23:59:29 -0800, Sébastien Ramage [EMAIL PROTECTED]
  wrote:
 
  des exemples de plugins pour IE oui mais qui ne sont pas embarqué dans
  une page Web
  je souhaiterai créer qqchose qui ressemble vraiment à Java VM ou
  Flash
  J'ai trouvé un début de réponse pour Firefox en télécharger le
  GeckoSDK
  mais je n'arrive pas à compiler les exemples pour le moment...
 
  merci
 
 
  MC a écrit :
 
   Bonjour !
  
   Pour IE, il y a des exemples de plugins, fournis avec PyWin32.
   Pour FF (comme pour Opera), je ne sais pas.
  
   --
   @-salutations
  
   Michel Claveau
 
 
 
  --
  http://mail.python.org/mailman/listinfo/python-list
 
 


 --
 Dr. Andre P. Meyerhttp://python.openspace.nl/meyer

 TNO Defence, Security and Safety   http://www.tno.nl/
 Delft Cooperation on Intelligent Systems  http://www.decis.nl/

 Ah, this is obviously some strange usage of the word 'safe' that I
 wasn't previously aware of. - Douglas Adams






--
Dr. Andre P. Meyerhttp://python.openspace.nl/meyer
TNO Defence, Security and Safety  http://www.tno.nl/
Delft Cooperation on Intelligent Systems  http://www.decis.nl/

Ah, this is obviously some strange usage of the word 'safe' that I wasn't
previously aware of. - Douglas Adams
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python Plugin for Web Browser

2006-12-06 Thread Michel Claveau
Re !

Je ne sais pas quel est ton objectif, mais il est possible de couplet 
Python  Javascript, de manière à générer/modifier/piloter le contenu 
HTML de pages Web depuis Python. Je fais ça tous les jours (avec IE)

Pour cela je passe par COM.

Malheureusement, à cause de la paranoïa sécuritaire ambiante, il y a de 
plus en plus de contraintes et d'obtacles.

Ainsi, s'il n'y a pas (encore) trop de problèmes tant que l'on est en 
local (avec les .HTA, par exemple), dès que l'on est distant (Intranet, 
Extranet, Web), il y a maintenant des confirmations à tout bout de 
champ, des avertissements peu utiles, mais devenus incontournables, des 
boîte de dialogues intempestives, etc.

Donc, si c'est pour utiliser comme interface pour des applis sur le 
disque (ou le réseau local), OK ; sinon, ça posera des problèmes.

C'en est à tel point que je me demande si l'utilisation de frontaux 
HTML comme GUI est toujours intéressante.
Et le problème ne touche pas que Python. Par exemple, j'ai un client 
qui utilise un logiciel de gestion de l'assurance qualité, utilisant 
des navigateurs comme interface. Du coup, ils ont des patchs 2 fois par 
mois, et les utilisateurs ont toujours plus choses à valider...

-- 
@-salutations

Michel Claveau


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Plugin for Web Browser

2006-12-06 Thread Sébastien Ramage

oui COM je connais et ça fonctionne bien mais ce n'est pas portable
d'un navigateur à l'autre et ce n'est pas ce que je cherche à faire.
Mon but serait d'avoir un plugin qui permettrait d'embarquer des
applets écrient en python dans les pages html à l'image de Java ou
Flash, etc
Pour le moment j'essaie de générer un plugin pour firefox avec le
Gecko SDK fourni par Mozilla (car bizarrement je ne trouve rien coté
IE...) mais ce n'est pas gagné vu mon niveau en C++... Je n'arrive pas
à compiler l'exemple.
As-tu des connaissances en C++ ? avec Visual C++ ?

Seb


Michel Claveau a écrit :

 Re !

 Je ne sais pas quel est ton objectif, mais il est possible de couplet
 Python  Javascript, de manière à générer/modifier/piloter le contenu
 HTML de pages Web depuis Python. Je fais ça tous les jours (avec IE)

 Pour cela je passe par COM.

 Malheureusement, à cause de la paranoïa sécuritaire ambiante, il y a de
 plus en plus de contraintes et d'obtacles.

 Ainsi, s'il n'y a pas (encore) trop de problèmes tant que l'on est en
 local (avec les .HTA, par exemple), dès que l'on est distant (Intranet,
 Extranet, Web), il y a maintenant des confirmations à tout bout de
 champ, des avertissements peu utiles, mais devenus incontournables, des
 boîte de dialogues intempestives, etc.

 Donc, si c'est pour utiliser comme interface pour des applis sur le
 disque (ou le réseau local), OK ; sinon, ça posera des problèmes.

 C'en est à tel point que je me demande si l'utilisation de frontaux
 HTML comme GUI est toujours intéressante.
 Et le problème ne touche pas que Python. Par exemple, j'ai un client
 qui utilise un logiciel de gestion de l'assurance qualité, utilisant
 des navigateurs comme interface. Du coup, ils ont des patchs 2 fois par
 mois, et les utilisateurs ont toujours plus choses à valider...
 
 -- 
 @-salutations
 
 Michel Claveau

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Plugin for Web Browser

2006-12-06 Thread MC
Bonsoir !

 As-tu des connaissances en C++ ? avec Visual C++ ?
Ben, non, je ne pratique pas ces machins.

Par contre, je pense qu'il existe une autre démarche, qui consiste à 
générer, à la volée, en Python, des sortes d'applets java/javascript.

Avantages : rien à installer ; milti-navigateurs
Inconvénient : ça se programme côté serveur.
Voir : Pyjamas (http://pyjamas.pyworks.org/FR/overview/)

-- 
@-salutations

Michel Claveau


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Plugin for Web Browser

2006-12-06 Thread Sébastien Ramage


 Par contre, je pense qu'il existe une autre démarche, qui consiste à
 générer, à la volée, en Python, des sortes d'applets java/javascript.

Il est clair que mon projet est un peu plus complexe mais je l'espère
plus ambitieux aussi
Le but étant vraimment de faire des applets en Python et non Java via
Jython ou autre


 Avantages : rien à installer ; milti-navigateurs
 Inconvénient : ça se programme côté serveur.
 Voir : Pyjamas (http://pyjamas.pyworks.org/FR/overview/)

oui d'ailleurs un utilisateur de Pyjamas m'a déjà contacté et il
serait intéressé par un plugin tel que je l'imagine.
Concernant les avantages je ne suis pas d'accord avec toi:
- rien à installer : oui par javascript mais non pour java il y a le
runtime à installer donc finalement avoir un runtime Python pourquoi
pas
- multi-navigateur : idem, rien n'interdit d'avoir un plugin
multi-plateforme et multi-navigateur, Java le fait bien lui alors
pourquoi pas Python

bref ça va certainement poser des tas de problèmes de sécurité et
je pense qu'un plugin 100% opérationnel ne verra pas le jour avant un
bon moment mais rien n'empèche de se lancer dans l'aventure !

Seb

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Plugin for Web Browser

2006-12-05 Thread MC
Bonjour !

Pour IE, il y a des exemples de plugins, fournis avec PyWin32.
Pour FF (comme pour Opera), je ne sais pas.

-- 
@-salutations

Michel Claveau


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python, WSGI, legacy web application

2006-11-22 Thread Graham Dumpleton

Ben Finney wrote:
 Howdy all,

 I'm working on a web application that is starting to gain a lot of
 back-end code written in Python. However, all the current interface
 code is written in legacy PHP. I'd like to slowly introduce new
 features as Python WSGI programs.

 Is it possible to write a Python WSGI program that talks to a PHP
 program as its back end? Where can I find out how to do this,
 preferably with examples?

 The ideal here is to keep all the existing code as is, but write
 little or no new PHP code. Instead, iteratively change the interface,
 replacing pieces of the monolithic legacy PHP interface with modular
 WSGI programs over time.

Look at mod_python for Apache. If you use it correctly you can on a
page by page basis as need be, replace the existing PHP pages with
equivalents written using Python. You could do this by programming
right at the level of mod_python, or again, if done right by using WSGI
on top of mod_python. If you need to maintain compatibility of URLs,
you could even do things so that even though URLs use .php, that it
maps to Python code underneath, thus easing any transition.

If you are interested in this path, the mod_python mailing list may be
a good place to go to discuss the mod_python aspects of this. The
mod_python mailing list details are on the mod_python web site at
www.modpython.org.


Graham

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python, WSGI, legacy web application

2006-11-22 Thread ToddG
 Ben Finney wrote:
 
  Is it possible to write a Python WSGI program that talks to a PHP
  program as its back end? Where can I find out how to do this,
  preferably with examples?

Perhaps:

http://pythonpaste.org/wphp/
http://blog.ianbicking.org/2006-wphp.html

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python, WSGI, legacy web application

2006-11-22 Thread Ben Finney
ToddG [EMAIL PROTECTED] writes:

  Ben Finney wrote:
   Is it possible to write a Python WSGI program that talks to a
   PHP program as its back end? Where can I find out how to do
   this, preferably with examples?

 Perhaps:

 http://pythonpaste.org/wphp/
 http://blog.ianbicking.org/2006-wphp.html

Looks good. Can anyone here tell any stories about using this for its
stated purpose?

Where would be the best place to ask further questions on this?

-- 
 \ Two paradoxes are better than one; they may even suggest a |
  `\  solution.  -- Edward Teller |
_o__)  |
Ben Finney

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python library for web discussions

2006-03-19 Thread Gregory Petrosyan
reddit is written with webpy (webpy.org), maybe you should give it a
try?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python library for web discussions

2006-03-19 Thread Amir Michail
Gregory Petrosyan wrote:
 reddit is written with webpy (webpy.org), maybe you should give it a
 try?

I'm looking for a library that provides commenting on items in a
similar way to reddit/digg/slashdot.  I would rather not write all that
code from scratch.

I don't think web.py comes with that functionality, although of course,
some free package may provide it on top of web.py.

Amir

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python library for web discussions

2006-03-19 Thread Irmen de Jong
Amir Michail wrote:
 Hi,
 
 I'm building something like digg/reddit and would like to allow people
 to have discussions on various items.
 
 Is there a simple lightweight python library that I can use (as opposed
 to a heavyweight web framework)?  Although not necessary, some sort of
 scoring/moderation mechanism would be good also (e.g., like
 reddit/slashdot).

If you don't mind that it is not possible to discuss in threads,
you may want to have a look at my blog server Frog:
http://snakelets.sourceforge.net/frog/

Ah, it doesn't support a scoring/moderation system too.
So it may not really suit your needs, but if you can't find
something else ;-)

--Irmen
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python library for web discussions

2006-03-19 Thread Pierre Quentel
Take a look at Karrigell (http://www.karrigell.com), it has a built-in
forum application

Regards,
Pierre

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and the web

2005-08-23 Thread bruno modulix
Joe T. wrote:
 Hello group, I'm new to Python and have a couple of beginner questions that
 I'm hoping someone can answer.
 
 1. Is python something that you would recommend using for server side web
 programming?  

Definitively yes.

 Something like C# or Java?  

Far better IMHO.

 If so, are there any resources
 that you could point me to that would help me with server side python
 programming for dynamic html data?  Most of the tutorials that I see deal
 with the Shell but I'd like to know more about using Python for database
 querying and printing database data on an html page as I would with .net's
 C# or Java.

If your need is to build a web frontend for relational datas, have a
look at Django:
http://www.djangoproject.com/

Else, you have a huge choice of web programming solutions in Python, the
 most known being Zope, Twisted/Nevow and CherryPy (but there are many
others).

 2. I know there's a Jpython but what use would I get from using Python with
 Java?  If I'm already familiar with Java programming why would I want to use
 Python with Java?

Because Python is much more usable than Java ?-)

But unless you need to work in a Java environnement, better stick to
CPython.


-- 
bruno desthuilliers
ruby -e print '[EMAIL PROTECTED]'.split('@').collect{|p|
p.split('.').collect{|w| w.reverse}.join('.')}.join('@')
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and the web

2005-08-23 Thread Jonas Geiregat
Terry Hancock wrote:

 
 Yes. If you're into killer apps, try out Zope.  But it does have a learning 
 curve.
 There are probably a dozen or so alternatives that are all smaller and 
 quicker
 to learn.


Very true zope is a killer app, but different from all the other well 
know server side languages. I myself am still in the learning stage but 
if you're into web development zope is the best around.
But pay attention zope hosting can be expensive and hard to find.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and the web

2005-08-22 Thread Fredrik Lundh
Joe T. wrote:

 2. I know there's a Jpython but what use would I get from using Python 
 with
 Java?  If I'm already familiar with Java programming why would I want to 
 use
 Python with Java?

see, e.g.

http://www.onjava.com/pub/a/onjava/2002/03/27/jython.html

http://www.javaworld.com/javaworld/jw-03-2005/jw-0314-scripting_p.html

http://opal.cabochon.com/~stevey/sokoban/docs/intro.html

http://lesscode.org/2005/08/22/history-repeats-itself/

/F 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and the web

2005-08-22 Thread Terry Hancock
On Monday 22 August 2005 03:51 pm, Joe T. wrote:
 1. Is python something that you would recommend using for server side web
 programming?  Something like C# or Java?  If so, are there any resources
 that you could point me to that would help me with server side python
 programming for dynamic html data?  Most of the tutorials that I see deal
 with the Shell but I'd like to know more about using Python for database
 querying and printing database data on an html page as I would with .net's
 C# or Java.

Yes. If you're into killer apps, try out Zope.  But it does have a learning 
curve.
There are probably a dozen or so alternatives that are all smaller and quicker
to learn.

 2. I know there's a Jpython but what use would I get from using Python with
 Java?  If I'm already familiar with Java programming why would I want to use
 Python with Java?

It's called Jython actually, and this is a FAQ at http://www.jython.org which
you should visit.  Jython also has its own mailing list, which is why you don't
see so much talk about it in this newsgroup (though people do mention it now
and again -- many questions are the same in any Python implementation).

In brief, however, you'd use Python with Java for the same reason so many
people with C background use Python instead of programming in C.

Or: You *can* in principle clean a washroom with a toothbrush,
but why would you want to?

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com

-- 
http://mail.python.org/mailman/listinfo/python-list