cropse

Python iterator&generator 2017- 3-24


先講結論:
Iterator 是透過一個class 內部宣告__iter__還有__next__(python2 是next)方法來達成可迭代(iterable)的物件(class)
Genetator 是透過yield簡單產生一個iterator的方法(method)

這是一般的iterator

class iterator(object):
    def __init__(self, start, stop):
        self.start = start
        self.stop = stop
    def __iter__(self):
        return ...

Tag: python

View

Circleci範例紀錄 2017- 2-20


這裡記錄使用Django_blog 在github每次push時使用circleci跑一次測試,circleci只使用一個專案不用錢(測試時間還是有限制)
基本上只要用circleci連結到你github的專案,專案有circle.yml就會在每次push時自動跑一次測試

circle.yml

dependencies:
    override:
        - sudo apt-get install python3 build-essential python3-dev python3-setuptools python3-pip -y
        - pyenv global 3.6.0
        - pip3 ...

Tag: CI/CD selenium testcase deploy

View

Selenium 試玩心得 2017- 2-18


簡單紀錄一下有遇到的問題:

遇到這個Error log

Unexpected Exception: Error: cross-process JS call failed.
安裝這個插件

安裝geckodriver

另外需要安裝geckodriver才能從執行,不然會有error
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

https://github.com/mozilla/geckodriver/releases ...

Tag: testcase selenium

View

Deploy設定簡單紀錄 2017- 2-07


這裡大概整理一下整個網站deploy的過程,等下次在詳細整理s3跟ec2設定的部分

django專案名稱是src, 路徑放置在/home/ubuntu/blog
先從配置文件開始
首先新增一個production.py在/home/ubuntu/blog/setting/
以下內容:


from .base import *
import os

# SECURITY WARNING: keep the secret key used in production secret!
# 請自己新增一個 不要直接用 http://www ...

Tag: AWS deploy uwsgi nginx postgresql

View