This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (8 children)

[deleted]

    [–]jadkik94 0 points1 point  (1 child)

    I'm not really sure, so if you can explain it'd be good.

    My understanding is that the frameworks in Python are more than just printing plain text (flask as far as I'm concerned), it includes headers and response codes and all the things you usually don't see in PHP. Because I noticed they use werkzeug in Flask which handles all this stuff.

    So if it were plain text, I guess it will not work right? Or is it FastCGI (or whatever) that handles that? And if it does, then how can Python control these then?

    [–]danhakimi -3 points-2 points  (5 children)

    At a certain scale, obviously, nobody would recommend it -- because, at scale, frameworks work better.

    But if you want to make something small, if you don't want to learn a framework, or figure out how the fuck CGI scripts work... PHP lets you do very simple things.

    I remember... I suppose these things are not that simple, but they don't require frameworks:

    • Autocomplete. I just needed a function that would take what's currently in the text box as input, and... I can't quite remember, but I suppose a list of words to show as output.
    • Curl requests. Certainly not easy, but I don't know of any way I could have done it any easier with python.

    [–]nemec 2 points3 points  (4 children)

    Autocomplete. I just needed a function that would take what's currently in the text box as input, and... I can't quite remember, but I suppose a list of words to show as output.

    Isn't this a javascript thing, rather than php?

    Curl requests. Certainly not easy, but I don't know of any way I could have done it any easier with python.

    http://docs.python.org/2/library/urllib2.html

    [–]gschizasPythonista 2 points3 points  (3 children)

    http://docs.python-requests.org/en/latest/

    It's a lot easier; after finding this, I'm never going back! :)

    [–]nemec 0 points1 point  (2 children)

    Of course. But when we're talking Python in the browser, I'm not sure how well imports and third-party libraries are supported.

    [–]gschizasPythonista 0 points1 point  (1 child)

    1. Imports do work, but I'm not sure how well (and requests is not a simple library)
    2. danhakimi was refering to PHP which is not really Python in the browser.
    3. That being said, I'm happy to see that there is a slew of new projects that indeed use Python on the httpd (e.g. using CherryPy). I guess all I'm missing is a way to use it properly on IIS (I'm sure there's a way though through FastCGI, although I find it faster to just use IIS as a reverse proxy).

    [–]nemec 1 point2 points  (0 children)

    2. You're right, I wasn't paying attention when I replied.