Make a blog with Flask

Init Fisst create a new repository which name “flask_site” on github. Then git clone to loacl. Init the env: $ cd flask_site $ mkvirtualenv -p python3 flask_site $ pip install flask $ pip install flask-login $ pip install flask-openid $ pip install flask-mail $ pip install flask-sqlalchemy $ pip install sqlalchemy-migrate $ pip install flask-whooshalchemy $ pip install flask-wtf $ pip install flask-babel $ pip install guess_language $ pip install flipflop $ pip install coverage Hello World $ mkdir blog $ cd blog $ mkdir app $ mkdir app/static $ mkdir app/templates $ mkdir tmp blog/app/__init__....

February 9, 2017 · 2 min · Me

Golang Quick Start

Quick Start ubuntu Install golang: sudo apt-get install golang mkdir -p $HOME/go_work/src/github.com/username/hello export GOPATH=$HOME/work For convenience, add the workspace’s bin subdirectory to your .bashrc: export GOPATH=$HOME/go_work export PATH=$PATH:$GOPATH/bin Save following to $GOPATH/src/github.com/username/hello/hello.go: package main import "fmt" func main() { fmt.Printf("hello, world\n") } compile and run: go install github.com/username/hello $GOPATH/bin/hello Done! My first golang programe package main import "fmt" // fibonacci // fibonacci 函数会返回一个返回 int 的函数。 func fibonacci() func() int { count := 0 a := 1 b := 1 return func() int { count++ if count <= 2 { a = 1 b = 1 return 1 } c := b b = a + b a = c return b } } func main() { f := fibonacci() for i := 0; i < 10; i++ { fmt....

January 18, 2017 · 1 min · Me

pandas 入门

建立环境 安装 pandas sudo apt-get install build-essential python-dev sudo apt-get install python-pandas python-tk sudo apt-get install python-scipy python-matplotlib python-tables sudo apt-get install python-numexpr python-xlrd python-statsmodels sudo apt-get install python-openpyxl python-xlwt python-bs4 安装 ipython-notebook sudo pip install "ipython[notebook]" sudo pip install pygments 运行 ipython-notebook ipython notebook #如果你使用matplotlib内嵌进网页中,那么需要运行: ipython notebook --matplotlib inline 导入 pandas import pandas as pd import numpy as np 读入数据 # 读入 CSV 格式数据 # 数据来源:http://boxofficemojo.com/daily/ df_movies = pd.read_csv('movies.csv', sep='\t', encoding='utf-8') df_movies....

February 7, 2015 · 3 min · Me

安装 Python 虚拟环境

Anaconda Install 官方网站:https://www.continuum.io/ 清华大学开源软件镜像站:https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/ conda 官方文档:https://docs.anaconda.com/ Anaconda 镜像使用帮助 Anaconda 是一个用于科学计算的 Python 发行版,支持 Linux, Mac, Windows, 包含了众多流行的科学计算、数据分析的 Python 包。 Anaconda 安装包可以到 https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ 下载。 TUNA 还提供了 Anaconda 仓库的镜像,运行以下命令: conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --set show_channel_urls yes 即可添加 Anaconda Python 免费仓库。 运行 conda install numpy 测试一下吧。 常用命令 查看版本: conda -V 或者 conda --version 查看信息: conda info 查看当前环境的包列表: conda list 搜索包: conda search beautifulsoup4 虚拟环境 创建虚拟环境: conda create -n env_name package_name python=3* 例如: conda create -n blog sphinx python=3* 查看有哪些虚拟环境: conda env list...

April 25, 2012 · 2 min · Me