simple db and django

I’m working on Project3 from my cs 462 class, where basically we need to make an ‘appserver’ which returns json stuff.
Rather than making my machine listen on port 8010 for the appserver and seperately on 80 for the regular webserver, I just got apache to listen on port 8010, and reused all my code from the webserver. (I know, pretty lazy eh. But I’m in a bit of a rush). Followed instructions on… actually I can’t find it. Google “apache listen different port”, but this site has ok instructions: http://httpd.apache.org/docs/2.0/vhosts/examples.html. (Basically: find the ports.conf file, and change “listen 80” to “listen 8010”).
———————————————-
So now I’m trying to add stuff to simple db. I receive a post from another page, and then add teh content of the post ot the db. I’m following the instructions on http://cloudcarpenters.com/blog/simpledb_primer_with_python_and_boto/.
Done: I know it’s working a bit.
I was getting big images instead of nice thumbnails. I found I was using the wrong url. needed to get images from amazon.com/…[imagekey]t.jpg. I was using the original image url.
ratesubmit. In the db it’s stored as an int with a max of 500, but we want to store it as a float with a max of 5.0. So, I created a function which simply divides all the ratings by 100 and turns them into floats with the following assignment:
image[‘rating’] = float(image[‘rating’])/100
Still, rating not actualy getting inputted. And it’s difficult to debug the page I visit sends a post to a page, which sends a post on teh server-side to teh page I want ot debug. I’m trying to user poster to send a post to that url, but it’s not working. Maybe I’ll just make my own form… Ok, so I used firebug (a better firefox plugin), made my own form in it with

Found some wacky stuff. I’m notious from programming so much. weee!
And was able to see the error on that page directly.
-view image isn’t working quite right. app expects a get parameter, but the request is coming in the form of http://blah.thing/%5Bvariablehere%5D, not http://blah.thing/?variable=%5Bvariablehere%5D. Luckily, I know django can handle this easily, I just don’t remember what this functionality is called
Logging for this project was super easy. You just send a post to a url with the info it wanted (I used python’s urlib, and urlib2, with teh commands urllib2.Request(‘http://imaj.lddi.org:8080/log/submit’,urllib.urlencode(params)), and urllib2.urlopen(newReq))

-save my personal testing webserver (make appserver’s url a variable)

I realized I forgot to implement part of gettin ga list of images. Specifically, I always get the set of first images.
SOoo… boy, I find this very difficult to just think right now. yikes.
cannot compute. DOES NOT COMPUUUTE!
if ratesort<=nextratesort

————————————–
ok now it’s all working, except the registering for the load balancer. Somehow my file which call the bash scrip tot restart it isn’t working. I htink I’ll just directly get the python userscript ot restart the server

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.