Remove Python pyc File

in python

Python interpreter在執行的時候會在每個package底下產生__pycache__ folder and .pyc, *.pyo file
一般而言這些file不會進入版本控管所以在.gitigore中通常會有
.py[co], pycache
但以上設定卻會在git branch switch時導致pyc, pyo殘留問題
以下介紹3種方法來處理

Continue reading

Upstart 筆記

in linux

Table of Contents

傳統init.d的取代方案,比init.d好寫很多
http://upstart.ubuntu.com/index.html

1 Example

開機時(有網路連接狀態)自動啟動Gunicorn,Crash時自動重啟,關機時關閉
將以下檔案放到/etc/init/gunicorn-superlists-staging.ottg.eu.conf

description "Gunicorn server for superlists-staging.ottg.eu"

start on net-device-up #start after net OK
stop on shutdown

respawn #restart if crash

setuid elspeth #user
chdir /home/elspeth/sites/superlists-staging.ottg.eu/source #working directory

#execute command
exec ../virtualenv/bin/gunicorn \
--bind unix:/tmp/superlists-staging.ottg.eu.socket \
--access-logfile ../access.log \
--error-logfile ../error.log \
superlists.wsgi:application

2 Command

sudo start gunicorn-superlists-staging.ottg.eu
sudo stop gunicorn-superlists-staging.ottg.eu
sudo restart gunicorn-superlists-staging.ottg.eu
Last Updated 2017-03-10 五 10:26.
Render by hexo-renderer-org with Emacs 25.2.1 (Org mode 8.2.10)

Comment and share

Cwza

Hello everyone.
I’m cwza.
Welcome to my blog.


Software Engineer


Taiwan/Taipei