Skip to content
Myr

Added installation docs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 625eba4 · Browse files · 1 file+98 added−1 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+98 added−1 removed

  • other:+98 added−1 removed

1 file+98 added−1 removed

modified:docs/installation.rst+98 added-1 removed
1 unmodified line
23Installation4============56Blafasel, add me6Flask is a microframework and yet it depends on external libraries. There7are various ways how you can install that library and this explains each8way and why there are multiple ways.910Flask depends on two external libraries: `Werkzeug11<http://werkzeug.pocoo.org/>`_ and `Jinja2 <http://jinja.pocoo.org/2/>`_.12The first on is responsible for interfacing WSGI the latter to render13templates. Now you are maybe asking, what is WSGI? WSGI is a standard14in Python that is basically responsible for ensuring that your application15is behaving in a specific way that you can run it on different16environments (for example on a local development server, on an Apache2, on17lighttpd, on Google's appengine or whatever you have in mind).1819So how do you get all that on your computer in no time? The most kick-ass20method is virtualenv, so let's look at that first.2122virtualenv23----------2425Virtualenv is what you want to use during development and in production if26you have shell access. So first: what does virtualenv do? If you are27like me and you like Python, chances are you want to use it for another28project as well. Now the more projects you have, the more likely it is29that you will be working with different versions of Python itself or a30library involved. Because let's face it: quite often libraries break31backwards compatibility and it's unlikely that your application will32not have any dependencies, that just won't happen. So virtualenv for the33rescue!3435It basically makes it possible to have multiple side-by-side36"installations" of Python, each for your own project. It's not actually37an installation but a clever way to keep things separated.3839So let's see how that works!4041If you are on OS X or Linux chances are that one of the following two42commands will for for you::4344 sudo easy_install virtualenv4546or even better::4748 sudo pip install virtualenv4950Changes are you have virtualenv installed on your system then. Maybe it's51even in your package manager (on ubuntu try ``sudo apt-get install52python-virtualenv``).5354On windows, just installed virtualenv from the `Python Package Index55<http://pypi.python.org/pypi/virtualenv>`_.5657So now that you have virtualenv running just fire up a shell and create58your own environment. I usually create a folder and a `env` folder59within::6061 $ mkdir myproject62 $ cd myproject63 $ virtualenv env64 New python executable in env/bin/python65 Installing setuptools............done.6667Now you only have to activate it, whenever you work with it. On OS X and68Linux do the following::6970 $ source env/bin/activate7172If you are a Windows user, the following command is for you::7374 $ env\scripts\activate7576Either way, you should now be using your virtualenv (see how the prompt of77your shell has changed to show the virtualenv).7879Now you can just enter the following command to get Flask activated in80your virtualenv::8182 $ easy_install Flask8384A few seconds later you are good to go.858687System Wide Installation88------------------------8990This is possible as well, but I would not recommend it. Just run91`easy_install` with root rights::9293 sudo easy_install Flask9495(Run it in an Admin shell on Windows systems and without the `sudo`). 969798The Drop into Place Version99---------------------------100101Now I really don't recommend this way on using Flask, but you can do that102of course as well. Download the `dip` zipfile from the website and unzip103it next to your application.