Installing Massive Coupon on Mac OS 10

4 comments

What will you need:

  1. Python 2.5+ - by default MAC OS 10 already have python installed, so actually for this one you don't have to do anything.
  2. Django 1.3 - a Python web framework
  3. MySQL - you are recommended to download the dmg
  4. MySQLDb - a Python-mysql connector
  5. Photologue - a photo management plugin for Django
  6. PIL - Python Imaging Library
  7. oauth - Python oauth library
  8. openid.consumer
  9. Massive coupon's source code
Installation steps:
  1. install mysql by running the dmg package
  2. login to mysql by: mysql -uroot
  3. mysql> create database massivecoupon;
  4. mysql> create user 'massive'@'localhost' identified by 'coupon';
  5. mysql> grant all privileges on massivecoupon.* to 'massive'@'localhost';
  6. install every required modules by: sudo python setup.py install
  7. untar massive coupon's source code and then update the settings.py file accordingly
  8. run: python manage.py syncdb
  9. run: python manage.py runserver
  10. remove this line from massivecoupon/engine/forms.py:
    from massivecoupon.libs import formutils
  11. go to browser and http://localhost:8000/admin
  12. login with the superuser credentials created before, and then setup everything

Tips for editing settings.py:

DEBUG = True

DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'massivecoupon'
DATABASE_USER = 'massive'
DATABASE_PASSWORD = 'coupon'
DATABASE_HOST = 'localhost'
DATABASE_PORT = '3306'

SESSION_COOKIE_DOMAIN = 'localhost'


Upon these installation steps, below are the errors that you are more likely going to encounter:

momotaro:MySQL-python-1.2.3 momotaro$ sudo python setup.py install
Password:
sh: mysql_config: command not found
Traceback (most recent call last):
File "setup.py", line 15, in
metadata, options = get_config()
File "/Users/momotaro/Downloads/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/Users/momotaro/Downloads/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found

solution:
> ln -s /usr/local/mysql/bin/* /usr/bin

File "/Library/Python/2.6/site-packages/django/db/backends/mysql/base.py", line 14, in
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/momotaro/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/momotaro/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so
Reason: image not found

Solution:
> sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
> sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql


Notes:
  • It is very important to install every required python modules completely, otherwise the applications won't run at all.
  • Need to stop and re-run the manage.py runserver after every installation of modules
  • It's also required to create a soft link from /var/www/massivecoupon to the real path of the massivecoupon folder itself, and then modify the permission of that folder to the proper user for rwx.
  • For any absence of modules you can try searching on this website: http://pypi.python.org/pypi/



Last updated: 11/04/2011
Finally can get it works, yay!!