Vegie #pasarpagi #iphonesia #instagood (Taken with instagram)
Vegie #pasarpagi #iphonesia #instagood (Taken with instagram)
Yesterday, I posted an article about the way to installing and configuring mod wsgi. After application hooked up successfully, I faced new problem. Because I use MySQL in XAMPP for Linux package, the MySQLdb for python didn’t find mysql sock on the default path. So, you need to manually specify the unix socket.
If you run the connection manually, probably the example is just like this :
import MySQLdb db = MySQLdb.connect( host = 'localhost', user = 'root', passwd = '', db = 'djangodb')
Then I got error like this :
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/pymodules/python2.7/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/MySQLdb/connections.py", line 188, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
So that means I need to specify unix socket. The syntax will be like this :
db = MySQLdb.connect( host = 'localhost', user = 'root', passwd = '', db = 'djangodb', unix_socket = '/opt/lampp/var/mysql/mysql.sock')
How I found mysql sock file path ? Just type this at terminal. And I got the path
ps -aux | grep mysqld nobody 6959 0.0 1.3 187900 27788 pts/4 Sl 01:41 0:14 /opt/lampp/sbin/mysqld --basedir=/opt/lampp --datadir=/opt/lampp/var/mysql --plugin-dir=/opt/lampp/lib/mysql/plugin --user=nobody --log-error=/opt/lampp/var/mysql/work085.err --pid-file=/opt/lampp/var/mysql/work085.pid --socket=/opt/lampp/var/mysql/mysql.sock --port=3306 root 11925 0.0 0.0 4448 796 pts/4 S+ 16:04 0:00 grep --color=auto mysqld
So, I need to change django settings too. I just put socket path (/opt/lampp/var/mysql/mysql.sock) as database host. Seems ridiculous but it works properly.
Cheers,
Source :
http://passingcuriosity.com/2009/specifying-a-unix-socket-using-mysql-with-django/
It’s been so long time I didn’t yet post anything. Office movement to new place was so hectic and take much time and energy also. In this post I would share my experience in Installing and configuring Mod WSGI which is needed if you in web development using Apache as your web server and you write web apps in Python based or using Django (or else Python Web Frameworks). In this occasion, I use XAMPP for Linux instead of dependent Apache and MySQL. If you use XAMPP for Linux, you also need the developer version. Because later on, you will compile mod_wsgi using apxs and python.
First, download XAMPP for Linux both XAMPP and XAMPP Development package.
Second, after both files downloaded. Extract it to /opt
tar xvfz xampp-linux-1.7.7.tar.gz -C /opt tar xvfz xampp-devel-1.7.7.tar.gz -C /opt
Third, download latest mod_wsgi from this server.
Fourth, extract mod_wsgi
tar xvfz mod_wsgi.X.Y.tar.gz
Fifth, Install python-dev
sudo apt-get install python-dev
Sixth, compile mod_wsgi source code
./configure --with-apxs=/opt/lampp/bin/apxs --with-python=/usr/bin/python make make install
mod_wsgi file will be created on /opt/lampp/modules/mod_wsgi.so
You can enable it by load it on httpd.conf just like another module.
Cheers,
Old city set #iphonesia (Taken with instagram)
Old city set #iphonesia #instagood (Taken with instagram)
Before dismatled #instagood #iphonesia #server (Taken with Instagram at Infinite Frameworks Studios)
Last moment with server #iphonesia #instagood (Taken with Instagram at Infinite Frameworks Studios)
Aksi demonstrasi oleh para buruh kota Batam. Menolak kenaikan harga BBM sebagai aspirasi yang akan terus disuarakan !
Ke Sana !! #arrow #iphonesia (Taken with Instagram at Infinite Frameworks Studios)
Hari Jumat, bagi saya adalah hari baik. Hari munculnya ide baru dan biasanya (tidak sering) mood kerja terbawa santai. Mungkin karena besok adalah hari libur. Jumat ini saya iseng membuat 1 code yang cukup berguna jika kita ingin mengecek apakah suatu akun Paypal sudah terverifikasi atau belum.
Sungguh, di code ini. Tidak dibutuhkan 1 pun API Key atau apapun itu. yang dibutuhkan untuk pengecekan hanyalah akun paypal untuk pengecekan. Skrip ini juga tidak dimaksudkan untuk hal negatif.
Metode yang saya lakukan sepenuhnya menggunakan autentikasi normal, namun semua dilakukan curl nya PHP. Sehingga saya hanya cukup mengambil nilai balik / return value dari function yang sudah saya buat.
File ingin saya unggah, tapi lebih baik jika saya hanya menerima request saja. Yang tertarik boleh mention saya di Twitter. (lihat About). Siapa tahu skrip ini berguna buat anda. Tapi kalau sudah pakai API nya Paypal, maka skrip ini tidak akan berguna banyak.
Untuk mendapatkan API nya Paypal, silahkan mendaftar ke developer.paypal.com dan anda akan mendapatkan fasilitas yang cukup membantu.
Disclaimer : Saya tidak bertanggung jawab atas segala kesalahan atau malfunction dari coding yang ada di sini. Segala kerusakan dan akibat dari code ini adalah tanggung jawab anda sepenuhnya !
UI design in The Avengers
So awesome.
Definitely some interesting interfaces. So. Much. Translucence.
Character Posters: The Dark Knight Rises | Coming Soon
OMG.
Actually, even better.
More fun with Wander Weeks.