Saltycrane logo

Sofeng's Blog

Notes on Python, Django, and web development on Ubuntu Linux

    

Card store project #5: Redirecting my www-prefixed domain to my non-www-prefixed domain


For search engine optimization and analytics, I wanted to make http://www.handsoncards.com/ permanently redirect to http://handsoncards.com/. So I started Googling. It took me a while to figure this one out... The first few articles I read suggested using Rewrite directives in my .htaccess file but this didn't work for me (maybe because I'm using mod_python and Django?). Then I found I could use Rewrite in my httpd.conf file, but I got an infinite redirect loop. Finally, I found the solution from this discussion. Here's what I did. I'm using Django, mod_python ...

Read more...

Card store project #4: Notes on using Amazon's CloudFront


I haven't been keeping up with the current events very well recently, but I haven't noticed a lot of people using Amazon's S3 or CloudFront with Django on VPS hosting. Though there is Adrian's post from 2006, I see more articles about serving media files with lighttpd or, more recently, nginx. Is a CDN unnecessary for our needs? I thought it'd be good to take some load off my VPS server since I need all the memory I can get for my Django web server and database. But maybe web servers such as nginx are ...

Read more...

Postgres backup with cron


So I accidentally deleted my Postgres database on my public server instead of my local server last night. Luckily, I was still in the testing phase. I had been meaning to figure out how to backup Postgres but had been putting it off. Now I've been provided the proper motivation.

The PostgreSQL documentation has a whole chapter devoted to backup. There it describes three methods of backup: SQL dump, file system level backup, and continuous archiving. I chose SQL dump.

To do a manual dump, here is what I did. (As you might guess, handsoncards_db is my database name ...

Read more...

Card store project #3: Installing Satchmo, part 2


Here are my initial steps in setting up my Satchmo store. It is meant to be a continuation of my previous post, Installing Satchmo, Django, PostgreSQL, and Apache on Ubuntu at Slicehost. I am using Satchmo version 0.8, released 2008-11-25. I am combining the instructions from the Satchmo documentation and Bruce's blog post. I'm sorry if this post is redundant-- I just wanted to have all the notes in one place for my reference. Almost all the instructions here are from one of these two sources.

Here is my final project directory structure mostly copied from Bruce ...

Read more...

Card store project #2: Installing Satchmo, Django, PostgreSQL, and Apache on Ubuntu at Slicehost


As I mentioned in my previous post, I'm planning to set up an e-commerce site using the Satchmo shopping cart framework. Satchmo is built on the Django web framework which is written in the Python programming language. Satchmo has a lot of features built in which means it saves you a lot of work implementing them yourself. Check out this video introduction to Satchmo at this year's DjangoCon for more information.

After reading this discussion on the Satchmo mailing list, I decided to use Slicehost for hosting my site. Their cheapest plan provides 256MB of RAM for $20 ...

Read more...
Created with Django | Hosted by Webfaction