Edited the installation guide.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Matt Campbell · committed by Armin Ronacher · parent f3dd3da · Browse files · 1 file·+66 added−71 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+66 added−71 removed
- other:+66 added−71 removed
Provenance
- Commit
f5e5330- Tree
54aee47- Author
Matt Campbell <mattcampbell@pobox.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
f3dd3da
1 file changed+66 added−71 removed
modified:docs/installation.rst+66 added-71 removed
1 unmodified line2 3 Installation4 ============5 6-Flask is a microframework and yet it depends on external libraries. There7-are various ways how you can install that library and this explains each8-way and why there are multiple ways.9-10-Flask depends on two external libraries: `Werkzeug6+Flask depends on two external libraries, `Werkzeug7 <http://werkzeug.pocoo.org/>`_ and `Jinja2 <http://jinja.pocoo.org/2/>`_.12-The first one is responsible for interfacing WSGI the latter for rendering13-templates. Now you are maybe asking, what is WSGI? WSGI is a standard14-in Python that is basically responsible for ensuring that your application15-is behaving in a specific way so that you can run it on different16-environments (for example on a local development server, on an Apache2, on17-lighttpd, on Google's App Engine or whatever you have in mind).8+Werkzeug is a toolkit for WSGI, the standard Python interface between web9+applications and a variety of servers for both development and deployment.10+Jinja2 renders templates.11 19-So how do you get all that on your computer in no time? The most kick-ass20-method is virtualenv, so let's look at that first.12+So how do you get all that on your computer quickly? There are many ways13+which this section will explain, but the most kick-ass method is14+virtualenv, so let's look at that first.15 16 .. _virtualenv:17 18 virtualenv19 ----------20 27-Virtualenv is what you want to use during development and in production if28-you have shell access. So first: what does virtualenv do? If you are29-like me and you like Python, chances are you want to use it for another30-project as well. Now the more projects you have, the more likely it is31-that you will be working with different versions of Python itself or at32-least an individual library. Because let's face it: quite often libraries33-break backwards compatibility and it's unlikely that your application will34-not have any dependencies, that just won't happen. So virtualenv to the35-rescue!21+Virtualenv is probably what you want to use during development, and in22+production too if you have shell access there.23 37-It basically makes it possible to have multiple side-by-side38-"installations" of Python, each for your own project. It's not actually39-an installation but a clever way to keep things separated.24+What problem does virtualenv solve? If you like Python as I do,25+chances are you want to use it for other projects besides Flask-based26+web applications. But the more projects you have, the more likely it is27+that you will be working with different versions of Python itself, or at28+least different versions of Python libraries. Let's face it; quite often29+libraries break backwards compatibility, and it's unlikely that any serious30+application will have zero dependencies. So what do you do if two or more31+of your projects have conflicting dependencies?32 41-So let's see how that works!33+Virtualenv to the rescue! It basically enables multiple side-by-side34+installations of Python, one for each project. It doesn't actually35+install separate copies of Python, but it does provide a clever way36+to keep different project environments isolated.37 38+So let's see how virtualenv works!39+43-If you are on OS X or Linux chances are that one of the following two40+If you are on Mac OS X or Linux, chances are that one of the following two41 commands will work for you::42 43 $ sudo easy_install virtualenv44 45 or even better::46 47 $ sudo pip install virtualenv48 52-Chances are you have virtualenv installed on your system then. Maybe it's53-even in your package manager (on ubuntu try ``sudo apt-get install54-python-virtualenv``).49+One of these will probably install virtualenv on your system. Maybe it's50+even in your package manager. If you use Ubuntu, try::51 56-If you are on Windows and missing the `easy_install` command you have to52+ $ sudo apt-get install python-virtualenv53+54+If you are on Windows and don't have the `easy_install` command, you must55 install it first. Check the :ref:`windows-easy-install` section for more56 information about how to do that. Once you have it installed, run the59-same commands as above, but without the `sudo` part.57+same commands as above, but without the `sudo` prefix.58 61-So now that you have virtualenv running just fire up a shell and create62-your own environment. I usually create a folder and a `env` folder63-within::59+Once you have virtualenv installed, just fire up a shell and create60+your own environment. I usually create a project folder and an `env`61+folder within::62 63 $ mkdir myproject64 $ cd myproject65 $ virtualenv env66 New python executable in env/bin/python67 Installing setuptools............done.68 71-Now you only have to activate it, whenever you work with it. On OS X and72-Linux do the following::69+Now, whenever you want to work on a project, you only have to activate70+the corresponding environment. On OS X and Linux, do the following::71 72 $ . env/bin/activate73 76-(Note the whitespace between the dot and the script name. This means77-execute this file in context of the shell. If the dot does not work for78-whatever reason in your shell, try substituting it with ``source``)74+(Note the space between the dot and the script name. The dot means that75+this script should run in the context of the current shell. If this command76+does not work in your shell, try replacing the dot with ``source``)77 78 If you are a Windows user, the following command is for you::79 80 $ env\scripts\activate11 unmodified lines92 93 System Wide Installation94 ------------------------95 98-This is possible as well, but I would not recommend it. Just run96+This is possible as well, but I do not recommend it. Just run97 `easy_install` with root rights::98 101- sudo easy_install Flask99+ $ sudo easy_install Flask100 103-(Run it in an Admin shell on Windows systems and without the `sudo`).101+(Run it in an Admin shell on Windows systems and without `sudo`).102 103 104 Living on the Edge105 ------------------106 109-You want to work with the latest version of Flask, there are two ways: you110-can either let `easy_install` pull in the development version or tell it111-to operate on a git checkout. Either way it's recommended to do that in a112-virtualenv.107+If you want to work with the latest version of Flask, there are two ways: you108+can either let `easy_install` pull in the development version, or tell it109+to operate on a git checkout. Either way, virtualenv is recommended.110 114-Get the git checkout in a new virtualenv and run in develop mode::111+Get the git checkout in a new virtualenv and run in development mode::112 113 $ git clone http://github.com/mitsuhiko/flask.git114 Initialized empty Git repository in ~/dev/flask/.git/115 $ cd flask4 unmodified lines120 $ python setup.py develop121 ...122 Finished processing dependencies for Flask123 127-This will pull in the dependencies and activate the git head as current128-version. Then you just have to ``git pull origin`` to get the latest129-version.124+This will pull in the dependencies and activate the git head as the current125+version inside the virtualenv. Then you just have to ``git pull origin``126+to get the latest version.127 128 To just get the development version without git, do this instead::129 130 $ mkdir flask10 unmodified lines141 142 `easy_install` on Windows143 -------------------------144 148-On Windows installation of `easy_install` is a little bit tricker because149-on Windows slightly different rules apply, but it's not a biggy. The150-easiest way to accomplish that is downloading the `ez_setup.py`_ file and151-running it. (Double clicking should do the trick)145+On Windows, installation of `easy_install` is a little bit tricker because146+slightly different rules apply on Windows than on Unix-like systems, but147+it's not difficult. The easiest way to do it is to download the148+`ez_setup.py`_ file and run it. The easiest way to run the file is to149+open your downloads folder and double-click on the file.150 153-Once you have done that it's important to add the `easy_install` command154-and other Python scripts to the path. To do that you have to add the155-Python installation's Script folder to the `PATH` variable.156-157-To do that, right-click on your "Computer" desktop icon and click158-"Properties". On Windows Vista and Windows 7 then click on "Advanced System159-settings", on Windows XP click on the "Advanced" tab instead. Then click151+Next, add the `easy_install` command and other Python scripts to the152+command search path, by adding your Python installation's Scripts folder153+to the `PATH` environment variable. To do that, right-click on the154+"Computer" icon on the Desktop or in the Start menu, and choose155+"Properties". Then, on Windows Vista and Windows 7 click on "Advanced System156+settings"; on Windows XP, click on the "Advanced" tab instead. Then click157 on the "Environment variables" button and double click on the "Path"161-variable in the "System variables" section.158+variable in the "System variables" section. There append the path of your159+Python interpreter's Scripts folder; make sure you delimit it from160+existing values with a semicolon. Assuming you are using Python 2.6 on161+the default path, add the following value::162 163-There append the path of your Python interpreter's Script folder to the164-end of the last (make sure you delimit it from existing values with a165-semicolon). Assuming you are using Python 2.6 on the default path, add166-the following value::167-163 ;C:\Python26\Scripts164 170-Then you are done. To check that it worked, open the cmd and execute171-"easy_install". If you have UAC enabled it should prompt you for admin172-privileges.165+Then you are done. To check that it worked, open the Command Prompt and166+execute ``easy_install``. If you have User Account Control enabled on167+Windows Vista or Windows 7, it should prompt you for admin privileges.168 169 170 .. _ez_setup.py: http://peak.telecommunity.com/dist/ez_setup.py