วันจันทร์ที่ 12 ธันวาคม พ.ศ. 2559

Install Turbogear2

How to Install Turbogears2 (Python web framework)
  1. install python 2.7
  2. install visual env
  3. create tg2env and use tg2env
  4. install turbogears in tg2env
  5. create project turbogears
  6. setup project
  7. run project
 Step 1 install python 2.7

download : https://www.python.org/downloads/release/python-2712/
for windows 64 bit: Windows x86-64 MSI installer


Download and Install python 2.7

วันอาทิตย์ที่ 2 ตุลาคม พ.ศ. 2559

Python Line Notify

1. go to https://notify-bot.line.me/my/ To Create Token with message

 
2. Create Toke, Click Generate Token


3. Enter Message to generate Token and Select group to notify and Click Generate Token
 
4. Click Copy Token key and close
5. Check in select group, please add LINE Notify into group.
6. Create python file and add code
# -*- coding: utf-8 -*-
import requests,json
LINE_ACCESS_TOKEN="Your Token" #token
url = "https://notify-api.line.me/api/notify"
msg = {"message":"Test Message"} #message
LINE_HEADERS = {'Content-Type':'application/x-www-form-urlencoded',"Authorization":"Bearer "+LINE_ACCESS_TOKEN}
session = requests.Session()
resp =session.post(url, headers=LINE_HEADERS, data=msg)
print(resp.text)

วันอาทิตย์ที่ 28 สิงหาคม พ.ศ. 2559

turbogears 2 Using Multiple Database

จาก multiple database
ลองมาเขียนเองดู สิ่งที่ต้องแก้ไข
  1. ไฟล์ development.ini
  2. ไฟล์ app_cfg.py [ myapp/config ]
  3. ไฟล์ __init__.py [ myapp/model ]

1. ไฟล์ development.ini










#sqlalchemy.url = sqlite:///%(here)s/devdata.db
sqlalchemy.first.url = sqlite:///%(here)s/database_1.db
sqlalchemy.second.url = sqlite:///%(here)s/database_2.db




Turbogears 2.3 on Heroku

Turbogears 2.3 on Heroku Step 1 : Install waitress pip install waitress Step 2 : Install turbogears app gearbox quickstart myproturb...