Setup server is always a pain in the ass (if you don’t know chef or other similar tools). It took me two days to get my django app running on the VPS. My problem is there are a lot of tutorials on the website, but few of them cover everything. Also the tutorials are not always working for me, there are many weird problems that are very difficult to Google. So I made some notes for myself, hope it can help you as well.

Postgresql 9.2 on CentOS 6.3

  • Order of entries in pg_hba.conf is important. Always add the new user to the top of the list (that means before host all all).
  • If localhost gives you ident error, try connect using -h Might be your VPS is using ipv6 address for localhost.
  • initdb with UTF8 support when your database is still empty.

Deploy Django using Apache + WSGI + Virtualenv

It seems simple from beginning because I have configured it with non-daemon mode before. This time I try to make it run in daemon mode. The tricky thing is there are many reasons for you to end up with a “ImportError: No module named django.core.wsgi” error. Here is a list you can go through to figure it out:

  • did you install using yum? The module in yum is only for Python 2.6 so you have to compile your own file.
  • run “ldd” to check if shows up. if not, you have to recompile python2.7 and mod_wsgi with –enable-shared option.
  • if it still gets that error, check the permission setting for your virtualenv folder, is the user running daemon has enough privilege?