installation.rst
This file
Path
docs/installation.rst
174 lines · 6.2 KiB
Last changed by
Use 'venv' consistently for virtualenv directory.Ron DuPlainbefore adoption0d2ffc0
History of this fileTake it
The walk stopped after 200 commits: lines older than 7331ae3 point at it.
Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 1–11why, one step back1.. _installation:23Installation4============56Flask depends on two external libraries, `Werkzeug7<http://werkzeug.pocoo.org/>`_ and `Jinja2 <http://jinja.pocoo.org/2/>`_.8Werkzeug is a toolkit for WSGI, the standard Python interface between web9applications and a variety of servers for both development and deployment.10Jinja2 renders templates.11tweaks to styleOri Livnehbefore adoption1a9e082
lines 12–14why, one step back12So how do you get all that on your computer quickly? There are many ways you13could do that, but the most kick-ass method is virtualenv, so let's have a look14at that first.Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 15why, one step back15tweaks to styleOri Livnehbefore adoption1a9e082
lines 16–19why, one step back16You will need Python 2.5 or higher to get started, so be sure to have an17up-to-date Python 2.x installation. At the time of writing, the WSGI18specification has not yet been finalized for Python 3, so Flask cannot support19the 3.x series of Python.Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 20–25why, one step back2021.. _virtualenv:2223virtualenv24----------25tweaks to styleOri Livnehbefore adoption1a9e082
lines 26–28why, one step back26Virtualenv is probably what you want to use during development, and if you have27shell access to your production machines, you'll probably want to use it there,28too.Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 29why, one step back29tweaks to styleOri Livnehbefore adoption1a9e082
lines 30–37why, one step back30What problem does virtualenv solve? If you like Python as much as I do,31chances are you want to use it for other projects besides Flask-based web32applications. But the more projects you have, the more likely it is that you33will be working with different versions of Python itself, or at least different34versions of Python libraries. Let's face it: quite often libraries break35backwards compatibility, and it's unlikely that any serious application will36have zero dependencies. So what do you do if two or more of your projects have37conflicting dependencies?Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 38why, one step back38tweaks to styleOri Livnehbefore adoption1a9e082
lines 39–42why, one step back39Virtualenv to the rescue! Virtualenv enables multiple side-by-side40installations of Python, one for each project. It doesn't actually install41separate copies of Python, but it does provide a clever way to keep different42project environments isolated. Let's see how virtualenv works.Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 43–52why, one step back4344If you are on Mac OS X or Linux, chances are that one of the following two45commands will work for you::4647 $ sudo easy_install virtualenv4849or even better::5051 $ sudo pip install virtualenv52tweaks to styleOri Livnehbefore adoption1a9e082
lines 53–54why, one step back53One of these will probably install virtualenv on your system. Maybe it's even54in your package manager. If you use Ubuntu, try::Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 55–59why, one step back5556 $ sudo apt-get install python-virtualenv5758If you are on Windows and don't have the `easy_install` command, you must59install it first. Check the :ref:`windows-easy-install` section for moretweaks to styleOri Livnehbefore adoption1a9e082
lines 60–61why, one step back60information about how to do that. Once you have it installed, run the same61commands as above, but without the `sudo` prefix.Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 62–63why, one step back6263Once you have virtualenv installed, just fire up a shell and createUse 'venv' consistently for virtualenv directory.Ron DuPlainbefore adoption0d2ffc0
line 64why, one step back64your own environment. I usually create a project folder and a `venv`Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 65–68why, one step back65folder within::6667 $ mkdir myproject68 $ cd myprojectvent and no more .Kenneth Reitzbefore adoption60f7e3a
lines 69–70why, one step back69 $ virtualenv venv70 New python executable in venv/bin/pythontypos and fixesKenneth Reitzbefore adoption5e84817
line 71why, one step back71 Installing distribute............done.Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 72why, one step back72tweaks to styleOri Livnehbefore adoption1a9e082
lines 73–74why, one step back73Now, whenever you want to work on a project, you only have to activate the74corresponding environment. On OS X and Linux, do the following::Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 75why, one step back75Use "." not "source" for shell sourcing.Ron DuPlainbefore adoptione070ede
line 76why, one step back76 $ . venv/bin/activateUpdate the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 77–79why, one step back7778If you are a Windows user, the following command is for you::79vent and no more .Kenneth Reitzbefore adoption60f7e3a
line 80why, one step back80 $ venv\scripts\activateUpdate the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 81why, one step back81tweaks to styleOri Livnehbefore adoption1a9e082
line 82why, one step back82Either way, you should now be using your virtualenv (notice how the prompt oftweak to one sentenceOri Livnehbefore adoption593b003
line 83why, one step back83your shell has changed to show the active environment).Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 84why, one step back84tweaks to styleOri Livnehbefore adoption1a9e082
lines 85–86why, one step back85Now you can just enter the following command to get Flask activated in your86virtualenv::Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 87why, one step back87vent and no more .Kenneth Reitzbefore adoption60f7e3a
line 88why, one step back88 $ pip install FlaskUpdate the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 89why, one step back89tweaks to styleOri Livnehbefore adoption1a9e082
line 90why, one step back90A few seconds later and you are good to go.Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 91–92why, one step back9192Merge pull request #369 from FND/docsArmin Ronacherbefore adoptionf64098c
line 93why, one step back93System-Wide InstallationUpdate the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 94–95why, one step back94------------------------95Merge pull request #369 from FND/docsArmin Ronacherbefore adoptionf64098c
line 96why, one step back96This is possible as well, though I do not recommend it. Just runMerge branch 'master' of github.com:mitsuhiko/flaskArmin Ronacherbefore adoption3249eeb
line 97why, one step back97`pip` with root privileges::Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 98why, one step back98pip and distribute installationKenneth Reitzbefore adoption4a75198
line 99why, one step back99 $ sudo pip install FlaskUpdate the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 100why, one step back100tweaks to styleOri Livnehbefore adoption1a9e082
line 101why, one step back101(On Windows systems, run it in a command-prompt window with administratortypos and fixesKenneth Reitzbefore adoption5e84817
line 102why, one step back102privileges, and leave out `sudo`.)Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 103–108why, one step back103104105Living on the Edge106------------------107108If you want to work with the latest version of Flask, there are two ways: youpip and distribute installationKenneth Reitzbefore adoption4a75198
line 109why, one step back109can either let `pip` pull in the development version, or you can telltweaks to styleOri Livnehbefore adoption1a9e082
line 110why, one step back110it to operate on a git checkout. Either way, virtualenv is recommended.Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 111–116why, one step back111112Get the git checkout in a new virtualenv and run in development mode::113114 $ git clone http://github.com/mitsuhiko/flask.git115 Initialized empty Git repository in ~/dev/flask/.git/116 $ cd flaskvent and no more .Kenneth Reitzbefore adoption60f7e3a
line 117why, one step back117 $ virtualenv venv --distributetypos and fixesKenneth Reitzbefore adoption5e84817
lines 118–119why, one step back118 New python executable in venv/bin/python119 Installing distribute............done.Use "." not "source" for shell sourcing.Ron DuPlainbefore adoptione070ede
line 120why, one step back120 $ . venv/bin/activateUpdate the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 121–125why, one step back121 $ python setup.py develop122 ...123 Finished processing dependencies for Flask124125This will pull in the dependencies and activate the git head as the currenttweaks to styleOri Livnehbefore adoption1a9e082
lines 126–127why, one step back126version inside the virtualenv. Then all you have to do is run ``git pull127origin`` to update to the latest version.Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 128–132why, one step back128129To just get the development version without git, do this instead::130131 $ mkdir flask132 $ cd flaskvent and no more .Kenneth Reitzbefore adoption60f7e3a
line 133why, one step back133 $ virtualenv venv --distributeUse "." not "source" for shell sourcing.Ron DuPlainbefore adoptione070ede
line 134why, one step back134 $ . venv/bin/activatevent and no more .Kenneth Reitzbefore adoption60f7e3a
lines 135–136why, one step back135 New python executable in venv/bin/python136 Installing distribute............done.pip and distribute installationKenneth Reitzbefore adoption4a75198
line 137why, one step back137 $ pip install Flask==devUpdate the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 138–142why, one step back138 ...139 Finished processing dependencies for Flask==dev140141.. _windows-easy-install:142pip and distribute installationKenneth Reitzbefore adoption4a75198
lines 143–144why, one step back143`pip` and `distribute` on Windows144-----------------------------------Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 145why, one step back145tweaks to styleOri Livnehbefore adoption1a9e082
line 146why, one step back146On Windows, installation of `easy_install` is a little bit trickier, but stillpip and distribute installationKenneth Reitzbefore adoption4a75198
lines 147–149why, one step back147quite easy. The easiest way to do it is to download the148`distribute_setup.py`_ file and run it. The easiest way to run the file is to149open your downloads folder and double-click on the file.Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
lines 150–153why, one step back150151Next, add the `easy_install` command and other Python scripts to the152command search path, by adding your Python installation's Scripts folder153to the `PATH` environment variable. To do that, right-click on thetweaks to styleOri Livnehbefore adoption1a9e082
line 154why, one step back154"Computer" icon on the Desktop or in the Start menu, and choose "Properties".tweaks to style and structureOri Livnehbefore adoptionc34a870
lines 155–159why, one step back155Then click on "Advanced System settings" (in Windows XP, click on the156"Advanced" tab instead). Then click on the "Environment variables" button.157Finally, double-click on the "Path" variable in the "System variables" section,158and add the path of your Python interpreter's Scripts folder. Be sure to159delimit it from existing values with a semicolon. Assuming you are usingpip and distribute installationKenneth Reitzbefore adoption4a75198
line 160why, one step back160Python 2.7 on the default path, add the following value::tweaks to style and structureOri Livnehbefore adoptionc34a870
line 161why, one step back161Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 162why, one step back162pip and distribute installationKenneth Reitzbefore adoption4a75198
line 163why, one step back163 ;C:\Python27\ScriptsUpdate the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 164why, one step back164tweaks to styleOri Livnehbefore adoption1a9e082
lines 165–167why, one step back165And you are done! To check that it worked, open the Command Prompt and execute166``easy_install``. If you have User Account Control enabled on Windows Vista or167Windows 7, it should prompt you for administrator privileges.Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 168why, one step back168pip and distribute installationKenneth Reitzbefore adoption4a75198
line 169why, one step back169Now that you have ``easy_install``, you can use it to install ``pip``::Update the testsuite to not freak out about a change in Werkzeug 0.8 that changed the behavior of misconfigured hosts.Armin Ronacherbefore adoption7331ae3
line 170why, one step back170pip and distribute installationKenneth Reitzbefore adoption4a75198
lines 171–174why, one step back171 > easy_install pip172173174.. _distribute_setup.py: http://python-distribute.org/distribute_setup.py