2016年1月24日 星期日

CentOS 7.2 安裝Python 3.4 + Django 1.9

安裝完成PostgreSQL後,接下來的重點,
就是要安裝Python 3.4 + Django + Django REST framework…
●安裝Python 3.4
sudo yum install Python34

sudo加在yum命令前,是用來讓安裝這個套件的動作,
取得super user的安裝套件權限,這樣一來就不用切換到root帳戶,可降低系統風險

2016年1月23日 星期六

CentOS 7.2 安裝 PostgreSQL 9.4

最近在使用CentOS 7.2 build 1511, 之後會用到django rest framework + postgreSQL
於是今天就嘗試安裝相關的環境,這篇就只記錄安裝 postgreSQL 9.4的部份…
首先,使用yum 安裝 postgreSQL 套件
postgreSQL 目前支援的linux作業系統與版本可以到官網上查詢,提供查詢網址如下:
http://yum.postgresql.org/repopackages.php
裡面有不同版本對應作業系統的Repository

2015年11月26日 星期四

[RWD] Google maps

RWD with Google maps…

reference:
http://webomnizz.com/how-to-make-responsive-google-map-with-google-map-api/

方法一:css
HTML內容:

<div class="map-canvas" id="map-canvas">

<iframe frameborder="0" height="350" marginheight="0" marginwidth="0" scrolling="no" src="https://www.google.com.tw/maps/@24.7655142,121.0162967,15z?hl=zh-TW" width="425"></iframe>

</div>



2015年11月23日 星期一

Python學習筆記(四) - Advanced Django models management

Django裡,model的資料操作與查詢,可進階寫成Manager,整個詳細過程記錄如下…

一、定義Manager class:
class TempleManager(models.Manager):
    def create_temple(self,name,locateRegion,religiousBelief,masterGod,address,latitude,longitude,phone1,phone2):
        temple = self.create(name = name, locateRegion = locateRegion, religiousBelief = religiousBelief, masterGod = masterGod, address = address, latitude = latitude, longitude = longitude, phone1 = phone1, phone2 = phone2)
        return temple

    def filter_temple(self,name,locateRegion,masterGod,address):
        temple = self.filter(name = name, locateRegion = locateRegion,  masterGod = masterGod, address = address)
        return temple

    def filterByMasterGod(self, masterGod):
        temple = self.filter(masterGod = masterGod)
        return temple

    def filterByRegion(self, locateRegion):
        temple = self.filter(locateRegion = locateRegion)
        return temple

2015年11月13日 星期五

Python學習筆記(三) - 部署到Microsoft Azure

今天上了Microsoft Azure課程後,一直想做一件事,就是把已經寫好的demo  site部署到azure上,在多次嘗試後,終於成功。當然必要條件是要先有一個Microsoft Azure的帳戶…
今天再為demo專案加入一個新的功能,就是輸入地址,轉換為經緯度的功能;透過google map api提供的功能,讓我們很輕鬆的完成這個功能。