49 thoughts on “Python Advanced Tutorial 7 – CGI Programming

  1. After apache is installed, I have 000-default.conf not the default file
    And the 000-default file is empty
    What to do

  2. I have the question how to organize a python script which will have to wait for a specific response to run a specific script through the cgi . In other words how to make the main.py running as a daemon in the infinite loop, which in its turn will receive requests i.e. http://127.0.0.1/1.py, http:/127.0.0.1/2.py etc. To explain what for I tell you that the specific script request takes to long. The TTFB (delay until a first bite) raises up to 3 secs. And we have the opinion that demonizing python scripts will help to reduce delays

  3. Hi. You stored the python file in var/www directory. Is it possible to store it in some other directory ad run the file in the browser?

  4. I really wish you had made another video explaining how to install apache2 or at least have mentioned where to skip in the description.

  5. Hi Draps,
    thanks for your Tutorial! Can you tell me, how to set a default value for the form fields (e.g. the text field) which is set by the python script?
    Like: <input type="text" name="foo" value="DEFAULT_VALUE">

  6. hai i am using ubuntu 16.04 ,i got struk at directories change ,so please give more clear explination give suggestions or url to search.

    Thanking u.

  7. it actual never create an executable even if i deleted the apache index.html and replace with my script called code.py still I get the list of my script

  8. Hallow ,I have been working into my simple project doing the CGI using the same operating system as you and the same configuration but there is no output once I run my local server it says you can not access this server
    Please help me

  9. Is it possible to write a chat program using CGI? I notice that writing a chat with the HTTP is a pain because the page has to reload every time a message is sent or received. Is there a way around this?

  10. TO NOTE!: CGI USES "getvalue()" not "getValue()". it does not like capital V.
    At the beginning of your script ALSO do
    import cgitb
    cgitb.enable()

    ISSUE I WAS HAVING. For some reason, this does not accept using "," to seperate strings…. you gotta use "+".

    Okay this doesn't fix it completely, but its a step forward! CHECK: https://docs.python.org/2/library/cgi.html

  11. When i downloaded apt-get install apache2, and i try to run it, it gives me syntax errors i.e. "Config Variable${APACHE_LOCK_DIR} is not defined " and "syntax error on line 74 of /etc/apache2/apache2.conf: invalid Mutex directory in argument file:${APACHE_LOCK_DIR}"

  12. hi. plz say, how i can set cookie for user in my site? i am write a script for auth, but cookies dont set. watch my script plz. pastebin.com/9xFtKhc2

  13. hi. i am on linux 12.04.I have installed xampp. And my folder is opt/lampp. In lampp folder there is separate acpache2 folder. i am confused with this. Bcz httpd.conf is different. can u show me your folder of etc and other? sned screenshots to me at [email protected]

  14. Can I create separate html file and then take data from it to the python file instead of doing html work in python. Is there any method for that.

  15. Thank you so much !!!! You are a genius !!! It worked perfect in Debian !!!!

    You know if it will work well in Angstrom ???

  16.  
    Hey ! I am using Ubuntu 14.04 LTS . I installed Apache2 , but i didn't get the default program what should i do now will you please help me

  17. Question:
    Say that I have an index.html that contains a form element with a post method and an action assigned to a python script. When viewing the html, I would select, within the form, "bring me a random number". The python script would gather the form name and post data and run a simple function that would generate a random number. How can I return the random number generated to the html page instead of using python to print a line of html containing the random number. I.e, is there an form method that retrieves values from a python script (given that the html form submitted a particular post)?

  18. I'm trying this on a Raspberry Pi… The first example does work, it displays the text without any problems. But when I try the second example it only displays the text but not the textbox or the checkboxes 🙁 Is there anything I need to install on the Pi? I don't think so since it doesn't show any errors, just the text.
    Help would be appreciated 🙂

  19. Hey ! I am using Ubuntu 14.04 LTS . I installed Apache2 ,  in the sites-available directory there is only 000-default.conf and default-ssl.conf and 1 mycgi.conf. I explicitly made a default.conf and copied the contents you showed in the slide.
    In the default 000-defafult.conf I changed the document room from /var/www/html to /var/www. But on typing 127.0.0.1 it says 404 PAGE NOT FOUND .
    Also , when I am normally typing 127.0.0.1 , it shows APACHE UBUNTU DEFAULT PAGE in which it has explained the configuration overview. I am just not able to proceed . Please help. Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *