FlaskはPythonでサーバーを構築するフレームワークである。ここでは、さくらサーバー上にFlaskかんっ峡を構築する方法について述べる。
なお、さくらサーバーのデフォルトのPythonは2.7.16でありバージョンが古いため、pyenv により3.6.9をインストールして、その上でFlaskを走らせることにする。
◎シェルログイン
login as: kisa0xx kisa0xx@kisa0xx.sakura.ne.jp's password: ←パスワードを入れる
◎FTPログイン
File protocol: SFTP Host name: kisa0xx.sakura.ne.jp Port number: 22 User name: kisa0xx Password: 空
以下の手順に従い、Python3の環境を構築する。
% echo $SHELL /bin/csh
% git clone https://github.com/yyuu/pyenv.git ~/.pyenv
.....
(末尾に入力)
# Setting for pyenv
if ( -e $HOME/.pyenv/bin/pyenv ) then
setenv PYENV_ROOT $HOME/.pyenv
setenv PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
setenv TMPDIR $HOME/tmp
pyenv rehash
endif
received too large sftp packet... The error typically caoused by message printed from startup script...
source .cshrc
% which python /usr/local/bin/python % python -V Python 2.7.16
% pyenv install 3.6.9
% pyenv global 3.6.9
% which python /home/kisa0xx/.pyenv/shims/python % python -V Python 3.6.9
% pip install Flask
% bash % LDFLAGS=-L/home/kisa0xx/tmp/hdf5/hdf5-1.10.5/hdf5/lib pip install keras
<!doctype html> <html> <head> <meta charset="utf-8"> <title>KISA021 Server</title> </head> <body> <h1>Welcome to KISA021 Server</h1> <p>私のサーバーへようこそ!</p> </body> </html>