Tag Archive | "Django"

Testing Email Locally with AppEngine Patch on Windows

Friday, March 5, 2010

0 Comments

If you need to get email working on your windows dev machine for Google AppEngine, here is one method: Download Fake Sendmail for Windows. Unzip the files and copy them into a new folder. Add this new folder to your windows PATH, by right clicking on My Computer -> Properties. Click Advanced Tab -> Environmental Variables. Edit [...]

Continue reading...

Shopper Talk Goes Live

Sunday, December 6, 2009

0 Comments

My latest project for Twitter. Try it out! http://shoppertalk.appspot.com It’s unbreakable. Ok, that’s not true, but I do need some testers. It’s a Django app running on Google App Engine. It utilizes the Twitter api and their OAuth implementation (so you can log in with your Twitter account). Currently only the Amazon product catalog is available for [...]

Continue reading...

UrlEncode in Python

Tuesday, November 3, 2009

0 Comments

To urlencode a querystring or form data in python you can use the urllib module: use urllib # you have to pass in a dictionary print urllib.urlencode({'id':'100', 'name':'john smith'}) # then you get 'id=100&name=john+smith' Urlencoding Unicode and UTF8 Values #this works fine print urllib.urlencode({name:'José'}) #you have to be careful with unicode strings # this will throw an error: print urllib.urlencode({name:u'José'}) # UnicodeDecodeError: 'ascii' codec can't decode [...]

Continue reading...

Using a favicon in Django

Sunday, November 1, 2009

0 Comments

The default location for a favicon.ico file is the root folder of website. However when using Django with an apache virtualhost, you need to map the location of your favicon. Here are a few ways to get you favicon working: 1) The quick way is to modify the html in your base template to include the [...]

Continue reading...

Dynamically Importing and Instantiating Modules in Python

Tuesday, October 13, 2009

0 Comments

Also called reflection, here is one method to import modules and instantiate objects using strings: moduleName = 'myApp.models' className = 'Blog' #import the module by saying 'from myApp.models import Blog' module = __import__(moduleName, {}, {}, className) #now you can instantiate the class obj = getattr(module, className )() #set a property of the object using a string setattr('Title','my first entry') #call an existing method you [...]

Continue reading...