發表文章

在django關於settings.py 的BASE_DIR路徑設置

圖片
剛開始學習django可能會對settings.py 的BASE_DIR路徑設置有疑惑,以下是一段python script 用來對於BASE_DIR路徑設置的理解: vi  test_path.py 運行這段名為test_path.py的python script 然可以看出test_path.py裡有關BASE_DIR的路徑設置了 還有就是settings.py裡TEMPLATES list 字典裡的DIRS要記得加上這段 os.path.join ( BASE_DIR , 'templates'  ,,這樣才不會出現 TemplateDoesNotExist  的錯誤回報 參考 參考

完全移除, 安裝,重啟nginx

如何完全移除nginx  sudo apt-get remove nginx nginx-common  sudo apt-get purge nginx nginx-common  sudo apt-get autoremove 再安裝niginx sudo apt-get install nginx 重啟nginx sudo /etc/init.d/nginx restart 參考

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.

在 virtualenv裡裝 psycopg2出現了一些問題  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. 解決方式 (venv)root@JoeServer# sudo apt-get install libpq-dev python-dev (venv)root@JoeServer#  pip install psycopg2 參考

參加pycon TW 2015

圖片

django test app error

練習 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  就成功了   參考

唐人傳奇

從小就很喜歡看神怪之類的小說,比如 聊齋志異 , 太平廣記 ,,,等,最近聽到某部電影要上映,,,又讓我想起,,隋唐時的奇幻神怪誌,記得專科時有讀過一篇叫 崑崙奴 的武俠小說,被文中的武功高強和深藏功與名的故事情節所折服,這“崑崙奴”是出自唐人傳奇中所收編的小說,原作者叫: 裴鉶 ,裴鉶還有另外一篇小說叫 聶隱娘 ,也是屬於神怪風格的小說,其實我感覺隋唐時期真是中國史上充滿傳奇幻怪誌的時代,,國力強盛而又華夷混血.

vim常用指令

在ubuntu會先下 sudo apt-get install vim 以下是我較常忘記的指令 nG,n 為數字。移動到這個檔案的第 n 行。例如 20G 則會移動到這個檔案的第 20 行(可配合 :set nu) gg,移動到這個檔案的第一行,相當於 1G 啊! 0 或功能鍵[Home] 這是數字『 0 』:移動到這一行的最前面字元處 $ 或功能鍵[End] 移動到這一行的最後面字元處 參考 移動游標到現在位置下10行  esc 10 enter 移動游標到現在位置上10行 esc 10-