Skip to content

twnanda/twnanda

Repository files navigation

如何在Windows系統上開發

image

第一次安裝

  1. 安裝 Cygwin64位元安裝檔

    安裝時,請將 Python 以及 Devel 選成 Install (不要選 Default

  2. 安裝須花頗多時間,完成後,在桌面建立一個 Cygwin Terminal 的捷徑。
  3. 點擊捷徑進入 Cygwin Terminal,進入後先檢查 Python 以及 git 是否安裝成功。

    先檢查 Python

    $ python -V

    如果成功會看到 Python 的版本號碼。

    接著檢查 git

    $ git --version

    如果成功會看到 git 的版本號碼。 接著設定user名稱跟email:

    $ git config --global user.name "twnanda"
    $ git config --global user.email "tw.nanda@gmail.com"
  4. 安裝 pip1

    $ easy_install-2.7 pip
  5. 進入D槽,建立github資料夾:

    $ cd /cygdrive/d/
    $ mkdir github
  6. 進入剛剛建立的github資料夾,把網站原始碼從GitHub上clone下來:

    $ cd /cygdrive/d/github/
    $ git clone https://github.com/twnanda/twnanda.git
  7. 進入原始碼目錄,用 pip 安裝需要的 Python 套件:

    $ cd /cygdrive/d/github/twnanda
    $ pip install -r requirements.txt
  8. 產生 JavaScript 及 CSS 檔

    $ cd /cygdrive/d/github/twnanda
    $ make js
    $ make scss
  9. 產生整個網站:

    $ cd /cygdrive/d/github/twnanda
    $ make

    打開 http://localhost:8000/ 可看產生的網站。

日常開發

進入原始碼目錄修改或新增檔案,完成後

$ cd /cygdrive/d/github/twnanda
$ make
# 此時打開瀏覽器(chrome, firefox, ...),拜訪網址:
# http://localhost:8000/
# 確認是否正確。

# 觀看還未加入的修改
$ git status
# 加入修改
$ git add ...
# 確認修改
$ git commit -m "..."
# 整合別人的修改
$ git pull
# 上傳修改到GitHub
$ git push
# 接著git會問帳號密碼,請輸入你的帳號密碼

Cygwin installation & Run Cygwin

  1. cygwin installation
    necessary package: Devel, Python
  2. python -V
  3. devel -V
  4. git -- version
  5. easy-install-2.7 pip
  6. cd d:

  1. click cygwin icon
     (cygwin window)
  2. cd /cygdrive/d/github/twnanda
  3. make
  4. open chrome (or firefox, ..., )
  5. url: http://localhost:8000
  6. make

    make serve
    (if no update)
  7. git status
    (red on file not added yet)
  8. git add dir/file
    (e.g. content/articles/tipitaka/sutta/khuddaka/dhammapada)
  9. git status
  10. git commit -m ""
    "remark what is added, changed, etc."
  11. git status
  12. git push
    upload github server

How to Develope (Ubuntu Linux)

Development Tool: pelican (static site generator written in Python)

Development Environment: Ubuntu 15.10

First-time Setup

  1. Install git and pip:
$ sudo apt-get install git
$ sudo apt-get install python3-pip
  1. git clone source code:
$ cd
$ mkdir dev
$ cd ~/dev/
$ git clone https://github.com/twnanda/twnanda.git
  1. Install Python tools:
$ cd ~/dev/twnanda/
$ sudo pip install -r requirements.txt
  1. Generate CSS/JS file:
$ cd ~/dev/twnanda/
$ make scss
$ make js
  1. Install language packages to add locale (Traditional Chinese):
$ sudo apt-get install language-pack-zh-hant

Daily Development

# start edit and develope
$ cd ~/dev/twnanda/
# If something changes, re-generate the website:
$ make html
# start dev server
$ make serve
# open your browser and preview the website at http://localhost:8000/

References


  1. python - Installing Pip-3.2 on Cygwin - Stack Overflow