Ok here is the steps that I found to work on Feb 2014. It takes me a few weeks to get it.
I have tried my 2 Mac
- Mac OS X 10.8.5 Mountain Lion
- Mac OS X 10.9 Maverick
Step 1. Install PostgreSQL 9.3
download postgresql-9.3.2-2-osx and install. This is first and easiest part. Then edit your python project setting in your python mysite settings.py file
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', #django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'postgres', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': 'postgres',
'PASSWORD': 'xxx',
'HOST': '127.0.0.1', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '5432', # Set to empty string for default.
}
}
Step 2. Install adapter psycopy2 2.5.2 for PostgreSQl to Python
PATH=$PATH:/Library/PostgreSQL/9.3/bin
cd psycopg2-2.5.2
python setup.py build
python setup.py install
sudo ln -s /Library/PostgreSQL/9.3/lib/libssl.1.0.0.dylib /usr/lib
sudo ln -s /Library/PostgreSQL/9.3/lib/libcrypto.1.0.0.dylib /usr/lib
Step 3. Install mod_wsgi-3.4 It is a module for apache to run python. I think OS X server has built in.
Goto terminal and cd to the mod_wsgi-3.4 directory
And type in ./configure
and then type in
for Maverick:
$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain
for mountain lion:
$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain
Then use finder and open the file makefile in mod_wsgi-3.4 directory. Edit the CPPFLAGS parameter by inserting the below
"
-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/apr-1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/apache2 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DENABLE_DTRACE -DMACOSX -DNDEBUG -DNDEBUG -DENABLE_DTRACE
"
Insert right after the "=" character. For mountain lion, replace 10.9 above with 10.8
example...
CPPFLAGS = -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/apr-1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/apache2 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DENABLE_DTRACE -DMACOSX -DNDEBUG -DNDEBUG -DENABLE_DTRACE
Lastly, type in
make
make install
And mod_wsgi.so should be created. It is used in the next step.
4. Configure Apache config file
- Goto terminal and edit the config file:
sudo pico /etc/apache2/httpd.conf
- Scroll down to load Module part and add wsgi
LoadModule wsgi_module libexec/apache2/mod_wsgi.so
WSGIScriptAlias / /Users/yongchong/Sites/mysite/mysite/wsgi.py
WSGIPythonPath /Users/yongchong/Sites/mysite
<Directory "/Users/yongchong/Sites/mysite/mysite">
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
....
<Directory "/Users/yongchong/Sites/mysite">
# /Library/WebServer/Documents">
....
exit and save config file
Then add permission here for apache at terminal
chmod +x /Users/yongchong/SitesSo the combination of apache + python + postgresql is really solid. It never fail.. 2 months and running!
And here you go!
It's cool! Thanks for the detailed description. I only had small issues with Configure Apache config file (I could not edit). I have been working in the field of software development and currently use an application from ios app development company. I would like to learn how to make such an application. This is certainly great!
ReplyDeleteIt is really an interesting and informative sharing. Just keep up the good work.
ReplyDeleteMobile Phone App Development
we are dreadfully thankful to all of your team for sharing such motivating information.
ReplyDeleteMObile App Development ::: iOS App Development
Great to hear about that you can check it out onces in IOS Online Training hyderabad
ReplyDelete
ReplyDeletetürk telekom mobil ödeme bozdurma
nft nasıl alınır
ankara evden eve nakliyat
trafik sigortası
DEDEKTOR
web sitesi kurma
aşk kitapları
ümraniye mitsubishi klima servisi
ReplyDeletebeykoz arçelik klima servisi
üsküdar arçelik klima servisi
tuzla bosch klima servisi
tuzla arçelik klima servisi
ümraniye lg klima servisi
çekmeköy samsung klima servisi
ataşehir samsung klima servisi
ümraniye samsung klima servisi