Flask 從新認識

  老是覺的學習東西有點猴子掰玉米的感受。今天就從新再掰一次吧。html

  Installation:python

    安裝以前建議先安裝virtualenv,這個東東是幫助你在多個python版本之間保持同步,不至於python版本變化了,項目就奔潰了。linux

    某些程序猿的裝備好些,可能用的是mac,自有類linux的安裝方法。無奈本屌絲只能在win下來寫寫程序。因此只提供win的virtualenv安裝方法:git

      到這裏下載http://flask.pocoo.org/docs/installation/#windows-easy-install, 建立python 文件,拷貝 distribute_setup.py的內容。而後雙擊便可。flask

      也可參考這篇文章,很是詳細:http://f.dataguru.cn/thread-36396-1-1.htmlwindows

 

     1. 安裝pip : easy_install.py pipide

     2. 安裝virtualenv: easy_install.py virtualenv學習

         安裝完成記得在環境變量裏面添加路徑。ui

 

APP:spa

  如今新建立一個文件夾,給這個文件夾設置python環境。

  

F:\>cd flask

F:\flask>cd picshow

F:\flask\picshow>virtualenv env
New python executable in env\Scripts\python.exe
Installing Setuptools...........................................................
................................................................................
................................................................................
.......................done.
Installing Pip..................................................................
................................................................................
................................................................................
................................................................................
.....................done.

F:\flask\picshow>

  接下來激活這個環境

env\Scripts\activate

  最後,爲應用添加Flask:

F:\flask\picshow>env\Scripts\activate
(env) F:\flask\picshow>pip install Flask
Downloading/unpacking Flask
  Downloading Flask-0.10.1.tar.gz (544kB): 544kB downloaded
  Running setup.py egg_info for package Flask

    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'docs'
    warning: no previously-included files matching '*.pyo' found under directory
 'docs'
    warning: no previously-included files matching '*.pyc' found under directory
 'tests'
    warning: no previously-included files matching '*.pyo' found under directory
 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'examples'
    warning: no previously-included files matching '*.pyo' found under directory
 'examples'
    no previously-included directories found matching 'docs\_build'
    no previously-included directories found matching 'docs\_themes\.git'
Downloading/unpacking Werkzeug>=0.7 (from Flask)
  Downloading Werkzeug-0.9.4.tar.gz (1.1MB): 1.1MB downloaded
  Running setup.py egg_info for package Werkzeug

    warning: no files found matching '*' under directory 'werkzeug\debug\templat
es'
    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'docs'
    warning: no previously-included files matching '*.pyo' found under directory
 'docs'
    warning: no previously-included files matching '*.pyc' found under directory
 'tests'
    warning: no previously-included files matching '*.pyo' found under directory
 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'examples'
    warning: no previously-included files matching '*.pyo' found under directory
 'examples'
    no previously-included directories found matching 'docs\_build'
Downloading/unpacking Jinja2>=2.4 (from Flask)
  Downloading Jinja2-2.7.1.tar.gz (377kB): 377kB downloaded
  Running setup.py egg_info for package Jinja2

    warning: no files found matching '*' under directory 'custom_fixers'
    warning: no previously-included files matching '*' found under directory 'do
cs\_build'
    warning: no previously-included files matching '*.pyc' found under directory
 'jinja2'
    warning: no previously-included files matching '*.pyc' found under directory
 'docs'
    warning: no previously-included files matching '*.pyo' found under directory
 'jinja2'
    warning: no previously-included files matching '*.pyo' found under directory
 'docs'
Downloading/unpacking itsdangerous>=0.21 (from Flask)
  Downloading itsdangerous-0.23.tar.gz (46kB): 46kB downloaded
  Running setup.py egg_info for package itsdangerous

    warning: no previously-included files matching '*' found under directory 'do
cs\_build'
Downloading/unpacking markupsafe (from Jinja2>=2.4->Flask)
  Downloading MarkupSafe-0.18.tar.gz
  Running setup.py egg_info for package markupsafe

Installing collected packages: Flask, Werkzeug, Jinja2, itsdangerous, markupsafe

  Running setup.py install for Flask

    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'docs'
    warning: no previously-included files matching '*.pyo' found under directory
 'docs'
    warning: no previously-included files matching '*.pyc' found under directory
 'tests'
    warning: no previously-included files matching '*.pyo' found under directory
 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'examples'
    warning: no previously-included files matching '*.pyo' found under directory
 'examples'
    no previously-included directories found matching 'docs\_build'
    no previously-included directories found matching 'docs\_themes\.git'
  Running setup.py install for Werkzeug

    warning: no files found matching '*' under directory 'werkzeug\debug\templat
es'
    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'docs'
    warning: no previously-included files matching '*.pyo' found under directory
 'docs'
    warning: no previously-included files matching '*.pyc' found under directory
 'tests'
    warning: no previously-included files matching '*.pyo' found under directory
 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'examples'
    warning: no previously-included files matching '*.pyo' found under directory
 'examples'
    no previously-included directories found matching 'docs\_build'
  Running setup.py install for Jinja2

    warning: no files found matching '*' under directory 'custom_fixers'
    warning: no previously-included files matching '*' found under directory 'do
cs\_build'
    warning: no previously-included files matching '*.pyc' found under directory
 'jinja2'
    warning: no previously-included files matching '*.pyc' found under directory
 'docs'
    warning: no previously-included files matching '*.pyo' found under directory
 'jinja2'
    warning: no previously-included files matching '*.pyo' found under directory
 'docs'
  Running setup.py install for itsdangerous

    warning: no previously-included files matching '*' found under directory 'do
cs\_build'
  Running setup.py install for markupsafe

    building 'markupsafe._speedups' extension
    ==========================================================================
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Failure information, if any, is above.
    Retrying the build without the C extension now.


    ==========================================================================
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Plain-Python installation succeeded.
    ==========================================================================
Successfully installed Flask Werkzeug Jinja2 itsdangerous markupsafe
Cleaning up...

(env) F:\flask\picshow>
View Code
相關文章
相關標籤/搜索