mirror of https://github.com/django/django.git
Fixed #31643 -- Changed virtualenv doc references to Python 3 venv.
This commit is contained in:
parent
ecaac9e42f
commit
8ce570f2f2
|
@ -48,9 +48,9 @@ your project package (``mysite`` in this example). This tells Apache to serve
|
||||||
any request below the given URL using the WSGI application defined in that
|
any request below the given URL using the WSGI application defined in that
|
||||||
file.
|
file.
|
||||||
|
|
||||||
If you install your project's Python dependencies inside a `virtualenv`_, add
|
If you install your project's Python dependencies inside a :mod:`virtual
|
||||||
the path to the virtualenv using ``WSGIPythonHome``. See the `mod_wsgi
|
environment <venv>`, add the path using ``WSGIPythonHome``. See the `mod_wsgi
|
||||||
virtualenv guide`_ for more details.
|
virtual environment guide`_ for more details.
|
||||||
|
|
||||||
The ``WSGIPythonPath`` line ensures that your project package is available for
|
The ``WSGIPythonPath`` line ensures that your project package is available for
|
||||||
import on the Python path; in other words, that ``import mysite`` works.
|
import on the Python path; in other words, that ``import mysite`` works.
|
||||||
|
@ -64,8 +64,7 @@ for you; otherwise, you'll need to create it. See the :doc:`WSGI overview
|
||||||
documentation</howto/deployment/wsgi/index>` for the default contents you
|
documentation</howto/deployment/wsgi/index>` for the default contents you
|
||||||
should put in this file, and what else you can add to it.
|
should put in this file, and what else you can add to it.
|
||||||
|
|
||||||
.. _virtualenv: https://virtualenv.pypa.io/
|
.. _mod_wsgi virtual environment guide: https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html
|
||||||
.. _mod_wsgi virtualenv guide: https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html
|
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ Here's an example command to start a uWSGI server::
|
||||||
--harakiri=20 \ # respawn processes taking more than 20 seconds
|
--harakiri=20 \ # respawn processes taking more than 20 seconds
|
||||||
--max-requests=5000 \ # respawn processes after serving 5000 requests
|
--max-requests=5000 \ # respawn processes after serving 5000 requests
|
||||||
--vacuum \ # clear environment on exit
|
--vacuum \ # clear environment on exit
|
||||||
--home=/path/to/virtual/env \ # optional path to a virtualenv
|
--home=/path/to/virtual/env \ # optional path to a virtual environment
|
||||||
--daemonize=/var/log/uwsgi/yourproject.log # background the process
|
--daemonize=/var/log/uwsgi/yourproject.log # background the process
|
||||||
|
|
||||||
This assumes you have a top-level project package named ``mysite``, and
|
This assumes you have a top-level project package named ``mysite``, and
|
||||||
|
@ -78,7 +78,7 @@ The Django-specific options here are:
|
||||||
* ``module``: The WSGI module to use -- probably the ``mysite.wsgi`` module
|
* ``module``: The WSGI module to use -- probably the ``mysite.wsgi`` module
|
||||||
that :djadmin:`startproject` creates.
|
that :djadmin:`startproject` creates.
|
||||||
* ``env``: Should probably contain at least :envvar:`DJANGO_SETTINGS_MODULE`.
|
* ``env``: Should probably contain at least :envvar:`DJANGO_SETTINGS_MODULE`.
|
||||||
* ``home``: Optional path to your project virtualenv.
|
* ``home``: Optional path to your project virtual environment.
|
||||||
|
|
||||||
Example ini configuration file::
|
Example ini configuration file::
|
||||||
|
|
||||||
|
|
|
@ -87,8 +87,9 @@ Installation
|
||||||
============
|
============
|
||||||
|
|
||||||
Once you're ready, it is time to :doc:`install the new Django version
|
Once you're ready, it is time to :doc:`install the new Django version
|
||||||
</topics/install>`. If you are using virtualenv_ and it is a major upgrade, you
|
</topics/install>`. If you are using a :mod:`virtual environment <venv>` and it
|
||||||
might want to set up a new environment with all the dependencies first.
|
is a major upgrade, you might want to set up a new environment with all the
|
||||||
|
dependencies first.
|
||||||
|
|
||||||
If you installed Django with pip_, you can use the ``--upgrade`` or ``-U`` flag:
|
If you installed Django with pip_, you can use the ``--upgrade`` or ``-U`` flag:
|
||||||
|
|
||||||
|
@ -97,7 +98,6 @@ If you installed Django with pip_, you can use the ``--upgrade`` or ``-U`` flag:
|
||||||
$ python -m pip install -U Django
|
$ python -m pip install -U Django
|
||||||
|
|
||||||
.. _pip: https://pip.pypa.io/
|
.. _pip: https://pip.pypa.io/
|
||||||
.. _virtualenv: https://virtualenv.pypa.io/
|
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
=======
|
=======
|
||||||
|
|
|
@ -305,26 +305,27 @@ Now you're ready to actually put the release out there. To do this:
|
||||||
$ scp Django-A.B.C.checksum.txt.asc djangoproject.com:/home/www/www/media/pgp/Django-A.B.C.checksum.txt
|
$ scp Django-A.B.C.checksum.txt.asc djangoproject.com:/home/www/www/media/pgp/Django-A.B.C.checksum.txt
|
||||||
|
|
||||||
#. Test that the release packages install correctly using ``easy_install``
|
#. Test that the release packages install correctly using ``easy_install``
|
||||||
and ``pip``. Here's one method (which requires `virtualenvwrapper`__)::
|
and ``pip``. Here's one method::
|
||||||
|
|
||||||
$ RELEASE_VERSION='1.7.2'
|
$ RELEASE_VERSION='1.7.2'
|
||||||
$ MAJOR_VERSION=`echo $RELEASE_VERSION| cut -c 1-3`
|
$ MAJOR_VERSION=`echo $RELEASE_VERSION| cut -c 1-3`
|
||||||
|
|
||||||
$ mktmpenv
|
$ python -m venv django-easy-install
|
||||||
|
$ . django-easy-install/bin/activate
|
||||||
$ easy_install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION.tar.gz
|
$ easy_install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION.tar.gz
|
||||||
$ deactivate
|
$ deactivate
|
||||||
$ mktmpenv
|
$ python -m venv django-pip
|
||||||
|
$ . django-pip/bin/activate
|
||||||
$ python -m pip install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION.tar.gz
|
$ python -m pip install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION.tar.gz
|
||||||
$ deactivate
|
$ deactivate
|
||||||
$ mktmpenv
|
$ python -m venv django-pip-wheel
|
||||||
|
$ . django-pip-wheel/bin/activate
|
||||||
$ python -m pip install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION-py3-none-any.whl
|
$ python -m pip install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION-py3-none-any.whl
|
||||||
$ deactivate
|
$ deactivate
|
||||||
|
|
||||||
This just tests that the tarballs are available (i.e. redirects are up) and
|
This just tests that the tarballs are available (i.e. redirects are up) and
|
||||||
that they install correctly, but it'll catch silly mistakes.
|
that they install correctly, but it'll catch silly mistakes.
|
||||||
|
|
||||||
__ https://pypi.org/project/virtualenvwrapper/
|
|
||||||
|
|
||||||
#. Ask a few people on IRC to verify the checksums by visiting the checksums
|
#. Ask a few people on IRC to verify the checksums by visiting the checksums
|
||||||
file (e.g. https://www.djangoproject.com/m/pgp/Django-1.5b1.checksum.txt)
|
file (e.g. https://www.djangoproject.com/m/pgp/Django-1.5b1.checksum.txt)
|
||||||
and following the instructions in it. For bonus points, they can also unpack
|
and following the instructions in it. For bonus points, they can also unpack
|
||||||
|
|
|
@ -152,8 +152,7 @@ If the ``source`` command is not available, you can try using a dot instead:
|
||||||
$ . ~/.virtualenvs/djangodev/bin/activate
|
$ . ~/.virtualenvs/djangodev/bin/activate
|
||||||
|
|
||||||
You have to activate the virtual environment whenever you open a new
|
You have to activate the virtual environment whenever you open a new
|
||||||
terminal window. virtualenvwrapper__ is a useful tool for making this
|
terminal window.
|
||||||
more convenient.
|
|
||||||
|
|
||||||
.. admonition:: For Windows users
|
.. admonition:: For Windows users
|
||||||
|
|
||||||
|
@ -163,8 +162,6 @@ more convenient.
|
||||||
|
|
||||||
...\> %HOMEPATH%\.virtualenvs\djangodev\Scripts\activate.bat
|
...\> %HOMEPATH%\.virtualenvs\djangodev\Scripts\activate.bat
|
||||||
|
|
||||||
__ https://virtualenvwrapper.readthedocs.io/en/latest/
|
|
||||||
|
|
||||||
The name of the currently activated virtual environment is displayed on the
|
The name of the currently activated virtual environment is displayed on the
|
||||||
command line to help you keep track of which one you are using. Anything you
|
command line to help you keep track of which one you are using. Anything you
|
||||||
install through ``pip`` while this name is displayed will be installed in that
|
install through ``pip`` while this name is displayed will be installed in that
|
||||||
|
|
|
@ -277,8 +277,8 @@ working. We'll now fix this by installing our new ``django-polls`` package.
|
||||||
users of the machine.
|
users of the machine.
|
||||||
|
|
||||||
Note that per-user installations can still affect the behavior of system
|
Note that per-user installations can still affect the behavior of system
|
||||||
tools that run as that user, so ``virtualenv`` is a more robust solution
|
tools that run as that user, so using a virtual environment is a more robust
|
||||||
(see below).
|
solution (see below).
|
||||||
|
|
||||||
#. To install the package, use pip (you already :ref:`installed it
|
#. To install the package, use pip (you already :ref:`installed it
|
||||||
<installing-reusable-apps-prerequisites>`, right?)::
|
<installing-reusable-apps-prerequisites>`, right?)::
|
||||||
|
@ -307,8 +307,8 @@ the world! If this wasn't just an example, you could now:
|
||||||
tutorial <https://packaging.python.org/tutorials/packaging-projects/#uploading-the-distribution-archives>`_
|
tutorial <https://packaging.python.org/tutorials/packaging-projects/#uploading-the-distribution-archives>`_
|
||||||
for doing this.
|
for doing this.
|
||||||
|
|
||||||
Installing Python packages with virtualenv
|
Installing Python packages with a virtual environment
|
||||||
==========================================
|
=====================================================
|
||||||
|
|
||||||
Earlier, we installed the polls app as a user library. This has some
|
Earlier, we installed the polls app as a user library. This has some
|
||||||
disadvantages:
|
disadvantages:
|
||||||
|
@ -319,7 +319,7 @@ disadvantages:
|
||||||
the same name).
|
the same name).
|
||||||
|
|
||||||
Typically, these situations only arise once you're maintaining several Django
|
Typically, these situations only arise once you're maintaining several Django
|
||||||
projects. When they do, the best solution is to use `virtualenv
|
projects. When they do, the best solution is to use :doc:`venv
|
||||||
<https://virtualenv.pypa.io/>`_. This tool allows you to maintain multiple
|
<python:tutorial/venv>`. This tool allows you to maintain multiple isolated
|
||||||
isolated Python environments, each with its own copy of the libraries and
|
Python environments, each with its own copy of the libraries and package
|
||||||
package namespace.
|
namespace.
|
||||||
|
|
|
@ -778,8 +778,6 @@ versioned
|
||||||
versioning
|
versioning
|
||||||
vertices
|
vertices
|
||||||
viewable
|
viewable
|
||||||
virtualenv
|
|
||||||
virtualenvs
|
|
||||||
virtualized
|
virtualized
|
||||||
Weblog
|
Weblog
|
||||||
whitelist
|
whitelist
|
||||||
|
|
|
@ -137,11 +137,11 @@ This is the recommended way to install Django.
|
||||||
it's outdated. If it's outdated, you'll know because installation won't
|
it's outdated. If it's outdated, you'll know because installation won't
|
||||||
work.
|
work.
|
||||||
|
|
||||||
#. Take a look at virtualenv_ and virtualenvwrapper_. These tools provide
|
#. Take a look at :doc:`venv <python:tutorial/venv>`. This tool provides
|
||||||
isolated Python environments, which are more practical than installing
|
isolated Python environments, which are more practical than installing
|
||||||
packages systemwide. They also allow installing packages without
|
packages systemwide. It also allows installing packages without
|
||||||
administrator privileges. The :doc:`contributing tutorial
|
administrator privileges. The :doc:`contributing tutorial
|
||||||
</intro/contributing>` walks through how to create a virtualenv.
|
</intro/contributing>` walks through how to create a virtual environment.
|
||||||
|
|
||||||
#. After you've created and activated a virtual environment, enter the command:
|
#. After you've created and activated a virtual environment, enter the command:
|
||||||
|
|
||||||
|
@ -150,8 +150,6 @@ This is the recommended way to install Django.
|
||||||
$ python -m pip install Django
|
$ python -m pip install Django
|
||||||
|
|
||||||
.. _pip: https://pip.pypa.io/
|
.. _pip: https://pip.pypa.io/
|
||||||
.. _virtualenv: https://virtualenv.pypa.io/
|
|
||||||
.. _virtualenvwrapper: https://virtualenvwrapper.readthedocs.io/en/latest/
|
|
||||||
.. _standalone pip installer: https://pip.pypa.io/en/latest/installing/#installing-with-get-pip-py
|
.. _standalone pip installer: https://pip.pypa.io/en/latest/installing/#installing-with-get-pip-py
|
||||||
|
|
||||||
.. _installing-distribution-package:
|
.. _installing-distribution-package:
|
||||||
|
@ -198,11 +196,12 @@ latest bug fixes and improvements, follow these instructions:
|
||||||
This will create a directory ``django`` in your current directory.
|
This will create a directory ``django`` in your current directory.
|
||||||
|
|
||||||
#. Make sure that the Python interpreter can load Django's code. The most
|
#. Make sure that the Python interpreter can load Django's code. The most
|
||||||
convenient way to do this is to use virtualenv_, virtualenvwrapper_, and
|
convenient way to do this is to use a virtual environment and pip_. The
|
||||||
pip_. The :doc:`contributing tutorial </intro/contributing>` walks through
|
:doc:`contributing tutorial </intro/contributing>` walks through how to
|
||||||
how to create a virtualenv.
|
create a virtual environment.
|
||||||
|
|
||||||
#. After setting up and activating the virtualenv, run the following command:
|
#. After setting up and activating the virtual environment, run the following
|
||||||
|
command:
|
||||||
|
|
||||||
.. console::
|
.. console::
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue