Last active
August 29, 2015 14:00
-
-
Save gophry/80c1485bdeef1056cbe9 to your computer and use it in GitHub Desktop.
MACOSX Python/Django/Postgres Development Setup Procedure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[A] VIRTUALENV | |
1. Open Terminal | |
2. sudo easy_install pip | |
3. sudo pip install virtualenv | |
4. sudo virtualenv {name of python virtual environment} | |
5. cd {virtual environment created} | |
6. source bin/activate | |
[B] DJANGO install & First Project Creation | |
1. pip install django | |
2. django-admin.py startproject {project name} [django-admin.py command will auto complete with a tab] | |
3. cd {project name} | |
4. ./manage.py startapp {appname - in django each module is considered an app. An app is plugable.} | |
5. pip install psycopg2 [seperate installation in every new virtualenv] | |
6. Make the following changes in settings.py | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.postgresql_psycopg2', | |
'NAME': 'name of the database', | |
'USER': 'username', | |
'PASSWORD': 'password', | |
'HOST': '127.0.0.1', | |
'PORT': '5432' | |
} | |
} | |
7. ./manage.py syncdb [Interactive will allow you to create an applicaiton superuser using default auth system of django] | |
8. ./manage.py runserver [http://127.0.0.1:8000] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[A] Install PostgreSQL on MACOSX. | |
1. Go to --> http://www.enterprisedb.com/products-services-training/pgdownload#osx | |
2. Unzip the downloaded the file and click on the installer file to start the installation. | |
3. /Library/PostgreSQL/9.3 as Default Path | |
4. /Library/PostgreSQL/9.3/data is the default path for data. | |
5. Set Superuser password.[superuser 'postgres'] | |
6. Check out Applications--> PostgreSQL 9.3(version you have installed) | |
7. pgAdmin!!! and psql commandline script is available for your comfort. | |
****************************************************** | |
Django to Connect to PostgreSQL uses psycopg2 package. | |
****************************************************** | |
--> Refer to MACOSX psycopg2 Driver package/VirtualEnv Settings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[A]psycopg2 connectivity settings. | |
1. export PATH=$PATH:/Library/PostgreSQL/9.3/bin/ [installed version with path to bin directory should be added to path] | |
2. sudo -E pip install psycopg2 | |
If required do upgrade to latest version of python. | |
[ERROR] clang error: unknown argument: '-mno-fused-madd' | |
1. export CFLAGS=-Qunused-arguments | |
2. export CPPFLAGS=-Qunused-arguments | |
Reference: http://stackoverflow.com/questions/22313407/clang-error-unknown-argument-mno-fused-madd-python-package-installation-fa | |
[ERROR] Reason: No Image found Error: | |
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 | |
Reference: http://www.goalbrecht.com/2013/12/install-pythonpostgresqlpsycopg2-on-os-x-mavericks-10-9/ |
libssl library not loaded error cleared after following same symlink steps for no image found error.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error loading psycopg2 module: dlopen(/Users/Tush/Documents/dev/grcvirtualenv/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: libssl.1.0.0.dylib