User:Cristinac/CGI: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "<div style="width:1000px;"> <pre> SelfPostingForms (look up on wiki) look up Simple chat.cgi and How am I being served? and How this wiki was set up? on wiki CGI script, Pira...")
 
No edit summary
Line 4: Line 4:
look up Simple chat.cgi and How am I being served?  and How this wiki was set up? on wiki
look up Simple chat.cgi and How am I being served?  and How this wiki was set up? on wiki
CGI script, Pirate Box  
CGI script, Pirate Box  
what does it mean to share a git on ssh


CGI script
CGI script
Line 58: Line 57:


raw_input vs input
raw_input vs input


exceptions are used so that the program doesn’t stop
exceptions are used so that the program doesn’t stop
Line 97: Line 94:
if you are using CSS sheets, you need to put them outside the cgi-bin
if you are using CSS sheets, you need to put them outside the cgi-bin


static python library GEOip
 
http://d3js.org/
http://d3js.org/



Revision as of 04:41, 9 June 2015

SelfPostingForms (look up on wiki)
look up Simple chat.cgi and How am I being served?  and How this wiki was set up? on wiki
CGI script, Pirate Box 

CGI script
Web 2.0 way of talking about interactive web

for example: Javascript plugin in browser app
giving a URL to your python script


https://pzwiki.wdka.nl/mediadesign/LetterWalk.cgi

http://www.greenteapress.com/thinkpython/swampy/

datetime=both name of module and name of class

create a date time object

1972,11,10 -M’s birthday :)



d=datetime.datetime(1991,11,9)
d.day()
type(d.day)
d.weekday()

put things into a variable if you know it will take some time to calculate

strftime

d.strftime("i was bored on a %A”)
d.strftime("i was bored on a %A, the %d %b”)



d=datetime.now()

n=datetime.datetime.now()
n.strftime("%Y%M%D”)

example of calculations: n+(n-d)

difference between method and module (any .py file, can also be a folder, can also be a module)


class=create fusions that have a little bit of data, and functions
datetime is a bunch of structure


datetime.timedelta



raw_input vs input

exceptions are used so that the program doesn’t stop



CGI


python -m SimpleHTTPServer 
then in browser go to: localhost:8000


to add CGI:
python -m CGIHTTPServer



to use, you need to mkdir cgi-bin in the same folder
then use command:
cp birthday.py cgi-bin/birthday.cgi

in the new code document, add #!usr/bin/env python at the top, so that the script knows it’s python



now make it executable by running: 
chmod +x cgi-bin/birthday.cgi 



if it keeps the values there, it’s called sticky form
stateless http
cookies are a form of sticky data


if you are using CSS sheets, you need to put them outside the cgi-bin


http://d3js.org/


there is only one ssh master that everyone shares