Skip to content
Myr

tweaks to style

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

authored by Ori Livneh · committed by Ron DuPlain · parent e5161a7 · Browse files · 1 file+54 added−56 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+54 added−56 removed

  • other:+54 added−56 removed

1 file+54 added−56 removed

modified:docs/installation.rst+54 added-56 removed
7 unmodified lines
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.1112So how do you get all that on your computer quickly? There are many ways,13as this section will explain, but the most kick-ass method is14virtualenv, so let's look at that first.12So 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.1516Either way, you will need Python 2.5 or higher to get started, so be sure17to have an up to date Python 2.x installation. At the time of writing,18the WSGI specification is not yet finalized for Python 3, so Flask cannot19support the 3.x series of Python.16You 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.2021.. _virtualenv:2223virtualenv24----------2526Virtualenv is probably what you want to use during development, and in27production too if you have shell access there.26Virtualenv 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.2929What problem does virtualenv solve? If you like Python as I do,30chances are you want to use it for other projects besides Flask-based31web applications. But the more projects you have, the more likely it is32that you will be working with different versions of Python itself, or at33least different versions of Python libraries. Let's face it; quite often34libraries break backwards compatibility, and it's unlikely that any serious35application will have zero dependencies. So what do you do if two or more36of your projects have conflicting dependencies?30What 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?3838Virtualenv to the rescue! It basically enables multiple side-by-side39installations of Python, one for each project. It doesn't actually40install separate copies of Python, but it does provide a clever way41to keep different project environments isolated.39Virtualenv 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.4343So let's see how virtualenv works!4444If you are on Mac OS X or Linux, chances are that one of the following two45commands will work for you::4647 $ sudo easy_install virtualenv
1 unmodified line
49or even better::5051 $ sudo pip install virtualenv5254One of these will probably install virtualenv on your system. Maybe it's55even in your package manager. If you use Ubuntu, try::53One of these will probably install virtualenv on your system. Maybe it's even54in your package manager. If you use Ubuntu, try::5556 $ 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 more61information on how to do that. Once you have it installed, run the62same commands as above, but without the `sudo` prefix.60information about how to do that. Once you have it installed, run the same61commands as above, but without the `sudo` prefix.6263Once you have virtualenv installed, just fire up a shell and create64your own environment. I usually create a project folder and an `env`65folder within::
3 unmodified lines
69 $ virtualenv env70 New python executable in env/bin/python71 Installing setuptools............done.7274Now, whenever you want to work on a project, you only have to activate75the corresponding environment. On OS X and Linux, do the following::73Now, whenever you want to work on a project, you only have to activate the74corresponding environment. On OS X and Linux, do the following::7576 $ . env/bin/activate7779(Note the space between the dot and the script name. The dot means that80this script should run in the context of the current shell. If this command81does not work in your shell, try replacing the dot with ``source``.)78(Note the space between the dot and the script name. The dot means that this79script should run in the context of the current shell. If this command does80not work in your shell, try replacing the dot with ``source``)8182If you are a Windows user, the following command is for you::8384 $ env\scripts\activate8587Either way, you should now be using your virtualenv (see how the prompt of86Either way, you should now be using your virtualenv (notice how the prompt of87your shell has changed to show the virtualenv).8890Now you can just enter the following command to get Flask activated in91your virtualenv::89Now you can just enter the following command to get Flask activated in your90virtualenv::9192 $ easy_install Flask9395A few seconds later you are good to go.94A few seconds later and you are good to go.959697System-Wide Installation98------------------------
2 unmodified lines
101`easy_install` with root privileges::102103 $ sudo easy_install Flask104106(Run it in an Admin shell on Windows systems and without `sudo`.)105(On Windows systems, run it in a command-prompt window with administrator106privleges, and leave out `sudo`.)107108109Living on the Edge110------------------111112If you want to work with the latest version of Flask, there are two ways: you113can either let `easy_install` pull in the development version, or tell it114to operate on a git checkout. Either way, virtualenv is recommended.113can either let `easy_install` pull in the development version, or you can tell114it to operate on a git checkout. Either way, virtualenv is recommended.115116Get the git checkout in a new virtualenv and run in development mode::117118 $ git clone http://github.com/mitsuhiko/flask.git
7 unmodified lines
126 ...127 Finished processing dependencies for Flask128129This will pull in the dependencies and activate the git head as the current130version inside the virtualenv. Then you just have to ``git pull origin``131to get the latest version.130version inside the virtualenv. Then all you have to do is run ``git pull131origin`` to update to the latest version.132133To just get the development version without git, do this instead::134135 $ mkdir flask
10 unmodified lines
146147`easy_install` on Windows148-------------------------149150On Windows, installation of `easy_install` is a little bit trickier because151slightly different rules apply on Windows than on Unix-like systems, but152it's not difficult. The easiest way to do it is to download the153`ez_setup.py`_ file and run it. The easiest way to run the file is to154open your downloads folder and double-click on the file.150On Windows, installation of `easy_install` is a little bit trickier, but still151quite easy. The easiest way to do it is to download the `ez_setup.py`_ file152and run it. The easiest way to run the file is to open your downloads folder153and double-click on the file.154155Next, add the `easy_install` command and other Python scripts to the156command search path, by adding your Python installation's Scripts folder157to the `PATH` environment variable. To do that, right-click on the159"Computer" icon on the Desktop or in the Start menu, and choose160"Properties". Then, on Windows Vista and Windows 7 click on "Advanced System161settings"; on Windows XP, click on the "Advanced" tab instead. Then click162on the "Environment variables" button and double-click on the "Path"163variable in the "System variables" section. There append the path of your164Python interpreter's Scripts folder; make sure you delimit it from165existing values with a semicolon. Assuming you are using Python 2.6 on158"Computer" icon on the Desktop or in the Start menu, and choose "Properties".159Then click on "Advanced System settings" (on Windows XP, click on the160"Advanced" tab instead). Then click on the "Environment variables" button and161double-click on the "Path" variable in the "System variables" section. There162append the path of your Python interpreter's Scripts folder. Be sure to delimit163it from existing values with a semicolon. Assuming you are using Python 2.6 on164the default path, add the following value::165166 ;C:\Python26\Scripts167170Then you are done. To check that it worked, open the Command Prompt and171execute ``easy_install``. If you have User Account Control enabled on172Windows Vista or Windows 7, it should prompt you for admin privileges.168And you are done! To check that it worked, open the Command Prompt and execute169``easy_install``. If you have User Account Control enabled on Windows Vista or170Windows 7, it should prompt you for administrator privileges.171172173.. _ez_setup.py: http://peak.telecommunity.com/dist/ez_setup.py