Bottle est un framework léger pour python. Le corps principal semble être un seul fichier. Si vous google, il y aura de nombreux articles en japonais, donc j'omettrai les détails.
http://bottlepy.org/docs/dev/index.html
Il sera mis à jour progressivement.
OS X Yosemite Ver 10.10.5
http://qiita.com/zaburo/items/fbdaf6c04151671407db http://qiita.com/zaburo/items/802423b0d2d63b0cb456
brew edit python
url "https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz"
sha256 "82929b96fd6afc8da838b149107078c02fa1744b7e60999a8babbc0d3fa86fc6"
sha256 "e22a23bec350c287ddcc1d48b1a58b2b27a8d19e79837fa684e71c2eb7ea6456" => :yosemite
Correction de la partie ci-dessus à ↓↓↓
url "https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz"
sha256 "eda8ce6eec03e74991abb5384170e7c65fcd7522e409b8e83d7e6372add0f12a"
sha256 "726e13ae4d0befdc86ae82c1585393de814609d8f6b2fda5ef2be8514f654c4d" => :yosemite
brew install python
réduction
which python
/usr/local/bin/python
pip2.7 install --upgrade pip
pip2.7 install --upgrade setuptools
pip2.7 install matplotlib
Collecting matplotlib
Downloading matplotlib-1.5.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (49.7MB)
100% |████████████████████████████████| 49.7MB 18kB/s
Collecting numpy>=1.6 (from matplotlib)
Downloading numpy-1.11.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.9MB)
100% |████████████████████████████████| 3.9MB 227kB/s
Collecting pytz (from matplotlib)
Downloading pytz-2016.4-py2.py3-none-any.whl (480kB)
100% |████████████████████████████████| 481kB 841kB/s
Collecting python-dateutil (from matplotlib)
Downloading python_dateutil-2.5.3-py2.py3-none-any.whl (201kB)
100% |████████████████████████████████| 204kB 576kB/s
Collecting cycler (from matplotlib)
Downloading cycler-0.10.0-py2.py3-none-any.whl
Collecting pyparsing!=2.0.0,!=2.0.4,>=1.5.6 (from matplotlib)
Downloading pyparsing-2.1.1-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil->matplotlib)
Downloading six-1.10.0-py2.py3-none-any.whl
Installing collected packages: numpy, pytz, six, python-dateutil, cycler, pyparsing, matplotlib
Successfully installed cycler-0.10.0 matplotlib-1.5.1 numpy-1.11.0 pyparsing-2.1.1 python-dateutil-2.5.3 pytz-2016.4 six-1.10.0
pip2.7 install pillow
pip2.7 install bottle
/path/to/bottle/app/main.py
from bottle import route, run, static_file, url
from top import index
@route('/static/<filepath:path>')
def static(filepath):
return static_file(filepath, root="./static")
@route('/')
def top():
return index(url)
run(host='localhost', port=8080, debug=True, reloader=True)
/path/to/bottle/app/top.py
from bottle import template, view
import const
@view("index")
def index(url):
return dict(url=url, design_path=const.DESIGN_PATH)
/path/to/bottle/app/const.py
DESIGN_PATH = './static/startbootstrap-sb-admin-2-1.0.8'
python main.py
http://localhost:8080/
myapp
├── const.py //Constant
├── main.py //routage
├── static //Configurer des fichiers statiques
│ ├─ css //Exemple: mettre css
│ ├─ js //Exemple: mettre js
│ └─ img //Exemple: mettre une image
├── top.py //Traitement de l'écran supérieur
└── views //Stockage de modèles
└── index.tpl //Modèle d'écran supérieur
/usr/local/lib/python2.7/site-packages/
Recommended Posts