練習 django test 的時候出現ㄧ些問題: Creating test database for alias 'default'... Got an error creating the test database: permission denied to create database Type 'yes' if you would like to try deleting the test database 'test_finance', or 'no' to cancel 後來發現是我postgresql 的資料庫使用者沒給予創建資料庫的權限,進入postgresql的root下以下指令: #ALTER USER django CREATEDB; //記得django要換成資料庫使用者的名字 然後 $ python manage.py test polls 就成功了 參考
在ubuntu server 14.04 裡安裝 psycopg2 出現了 A true SSLContext object is not available.,,,, 參考 下了sudo apt-get install libffi-dev libssl-dev,再pip install psycopg2後 A true SSLContext object is not available 的訊息就不再出現了
Error: You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-v5ZnhD/psycopg2 如果一直出現以上的psycopg2要執行以下的指令 sudo pip install --upgrade setuptools sudo apt-get install python-psycopg2 sudo apt-get install libpq-dev 再裝psycopg2 pip install psycopg2 ***************************************** In file included from psycopg/psycopgmodule.c:27:0: ./psycopg/psycopg.h:30:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1 如果一直出現以上的錯誤要執行以下的指令 sudo apt-get install python-dev 再裝psycopg2 pip install psycopg2 參考 參考