Ticket #13820: django-13820.diff

File django-13820.diff, 17.3 KB (added by Joshua Ginsberg <jag@…>, 9 years ago)

Patch to add warnings and update docs to piss on mod_python

  • docs/howto/apache-auth.txt

    ### Eclipse Workspace Patch 1.0
    #P django-trunk
     
    44Authenticating against Django's user database from Apache
    55=========================================================
    66
     7.. warning::
     8
     9    Support for mod_python will be deprecated in a future release of Django.
     10    At that time, this method of authentication will no longer be provided by
     11    Django. The community is welcome to offer its own alternate solutions
     12    using WSGI middleware or other approaches.
     13
    714Since keeping multiple authentication databases in sync is a common problem when
    815dealing with Apache, you can configuring Apache to authenticate against Django's
    916:ref:`authentication system <topics-auth>` directly. For example, you
  • docs/howto/static-files.txt

     
    3333production setting. Use this only for development.
    3434
    3535For information on serving static files in an Apache production environment,
    36 see the :ref:`Django mod_python documentation <serving-media-files>`.
     36see the :ref:`Django mod_wsgi documentation <serving-media-files>`.
    3737
    3838How to do it
    3939============
  • docs/howto/deployment/fastcgi.txt

     
    2222(via a socket) to FastCGI, which executes the code and passes the response back
    2323to the Web server, which, in turn, passes it back to the client's Web browser.
    2424
    25 Like mod_python, FastCGI allows code to stay in memory, allowing requests to be
    26 served with no startup time. Unlike mod_python_ (or `mod_perl`_), a FastCGI
    27 process doesn't run inside the Web server process, but in a separate,
     25Like mod_wsgi, FastCGI allows code to stay in memory, allowing requests to be
     26served with no startup time. While mod_wsgi can either be configured embedded
     27in the Apache webserver process or as a separate daemon process, a FastCGI
     28process never runs inside the Web server process, always in a separate,
    2829persistent process.
    2930
    3031.. _mod_wsgi: http://code.google.com/p/modwsgi/
    3132.. _mod_perl: http://perl.apache.org/
    32 .. _mod_python: http://www.modpython.org/
    3333
    3434.. admonition:: Why run code in a separate process?
    3535
     
    3737    languages (most notably PHP, Python and Perl) inside the process space of
    3838    your Web server. Although this lowers startup time -- because code doesn't
    3939    have to be read off disk for every request -- it comes at the cost of
    40     memory use. For mod_python, for example, every Apache process gets its own
    41     Python interpreter, which uses up a considerable amount of RAM.
     40    memory use.
    4241
    4342    Due to the nature of FastCGI, it's even possible to have processes that run
    4443    under a different user account than the Web server process. That's a nice
     
    363362
    364363Regardless of the server and configuration you eventually decide to use, you
    365364will also need to give some thought to how to serve the admin media files. The
    366 advice given in the :ref:`modpython <serving-the-admin-files>` documentation
     365advice given in the :ref:`mod_wsgi <serving-the-admin-files>` documentation
    367366is also applicable in the setups detailed above.
    368367
    369368Forcing the URL prefix to a particular value
  • docs/ref/signals.txt

     
    376376Arguments sent with this signal:
    377377
    378378    ``sender``
    379         The handler class -- i.e.
    380         :class:`django.core.handlers.modpython.ModPythonHandler` or
     379        The handler class -- e.g.
    381380        :class:`django.core.handlers.wsgi.WsgiHandler` -- that handled
    382381        the request.
    383382
  • docs/topics/settings.txt

     
    6666
    6767.. _django-admin.py: ../django-admin/
    6868
    69 On the server (mod_python)
     69On the server (mod_wsgi)
    7070--------------------------
    7171
    72 In your live server environment, you'll need to tell Apache/mod_python which
    73 settings file to use. Do that with ``SetEnv``::
     72In your live server environment, you'll need to tell your WSGI application what
     73settings file to use. Do that with ``os.environ``::
    7474
    75     <Location "/mysite/">
    76         SetHandler python-program
    77         PythonHandler django.core.handlers.modpython
    78         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
    79     </Location>
     75    import os
     76   
     77    os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
    8078
    81 Read the :ref:`Django mod_python documentation <howto-deployment-modpython>` for
    82 more information.
     79Read the :ref:`Django mod_wsgi documentation <howto-deployment-modwsgi>` for
     80more information and other common elements to a Django WSGI application.
    8381
    8482Default settings
    8583================
  • docs/howto/deployment/modpython.txt

     
    44How to use Django with Apache and mod_python
    55============================================
    66
     7.. warning::
     8
     9    Support for mod_python will be deprecated in a future release of Django. If
     10    you are configuring a new deployment, you are strongly encouraged to
     11    consider using :ref:`mod_wsgi <howto-deployment-modwsgi>` or any of the
     12    other :ref:`supported backends <howto-deployment-index>`.
     13
    714.. highlight:: apache
    815
    916The `mod_python`_ module for Apache_ can be used to deploy Django to a
     
    216223
    217224.. _mod_python documentation: http://modpython.org/live/current/doc-html/directives.html
    218225
    219 .. _serving-media-files:
    220 
    221226Serving media files
    222227===================
    223228
     
    269274.. _Apache: http://httpd.apache.org/
    270275.. _Cherokee: http://www.cherokee-project.com/
    271276
    272 .. _howto-deployment-modpython-serving-the-admin-files:
    273 
    274 .. _serving-the-admin-files:
    275 
    276277Serving the admin files
    277278=======================
    278279
  • docs/howto/deployment/modwsgi.txt

     
    5555replace 'mysite.settings' with your correct settings file, and '/usr/local/django'
    5656with your own project's location.
    5757
     58.. _serving-media-files:
     59
    5860Serving media files
    5961===================
    6062
     
    108110
    109111.. _hosting static files: http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#Hosting_Of_Static_Files
    110112
     113.. _serving-the-admin-files:
     114
     115Serving the admin files
     116=======================
     117
     118Note that the Django development server automagically serves admin media files,
     119but this is not the case when you use any other server arrangement. You're
     120responsible for setting up Apache, or whichever media server you're using, to
     121serve the admin files.
     122
     123The admin files live in (:file:`django/contrib/admin/media`) of the Django
     124distribution.
     125
     126Here are two recommended approaches:
     127
     128    1. Create a symbolic link to the admin media files from within your
     129       document root. This way, all of your Django-related files -- code **and**
     130       templates -- stay in one place, and you'll still be able to ``svn
     131       update`` your code to get the latest admin templates, if they change.
     132
     133    2. Or, copy the admin media files so that they live within your Apache
     134       document root.
     135
    111136Details
    112137=======
    113138
  • django/core/handlers/modpython.py

     
    11import os
    22from pprint import pformat
     3from warnings import warn
    34
    45from django import http
    56from django.core import signals
     
    179180    request_class = ModPythonRequest
    180181
    181182    def __call__(self, req):
     183        warn(('Support for serving Django requests with mod_python will be '
     184              'deprecated in a future release in favor of the mod_wsgi '
     185              'backend.'),
     186             PendingDeprecationWarning)
     187       
    182188        # mod_python fakes the environ, and thus doesn't process SetEnv.  This fixes that
    183189        os.environ.update(req.subprocess_env)
    184190
  • docs/ref/contrib/gis/deployment.txt

     
    5959``mod_python``
    6060--------------
    6161
     62.. warning::
     63    Support for mod_python will be deprecated in a future release of Django. If
     64    you are configuring a new deployment, you are strongly encouraged to
     65    consider using :ref:`mod_wsgi <howto-deployment-modwsgi>` or any of the
     66    other :ref:`supported backends <howto-deployment-index>`.
     67
    6268Example::
    6369
    6470    <VirtualHost *:80>
  • docs/releases/1.3.txt

     
    1919=====================================
    2020
    2121
     22.. _deprecated-features-1.3:
    2223
    2324Features deprecated in 1.3
    2425==========================
    2526
     27Django 1.3 deprecates some features from earlier releases.
     28These features are still supported, but will be gradually phased out
     29over the next few release cycles.
    2630
     31Code taking advantage of any of the features below will raise a
     32``PendingDeprecationWarning`` in Django 1.3. This warning will be
     33silent by default, but may be turned on using Python's `warnings
     34module`_, or by running Python with a ``-Wd`` or `-Wall` flag.
    2735
     36.. _warnings module: http://docs.python.org/library/warnings.html
     37
     38In Django 1.4, these warnings will become a ``DeprecationWarning``,
     39which is *not* silent. In Django 1.5 support for these features will
     40be removed entirely.
     41
     42.. seealso::
     43
     44    For more details, see the documentation :ref:`Django's release process
     45    <internals-release-process>` and our :ref:`deprecation timeline
     46    <internals-deprecation>`.`
     47
     48``mod_python`` support
     49----------------------
     50
     51The ``mod_python`` library has not had a release since 2007 or a commit since
     522008. The Apache Foundation board voted to remove ``mod_python`` from the set
     53of active projects in its version control repositories, and its lead developer
     54has shifted all of his efforts toward the lighter, slimmer, more stable, and
     55more flexible ``mod_wsgi`` backend.
     56
     57If you are currently using the ``mod_python`` request handler, it is strongly
     58encouraged you redeploy your Django instances using :ref:`mod_wsgi
     59<howto-deployment-modwsgi>`.
     60
    2861What's new in Django 1.3
    2962========================
    3063
    31 
  • docs/internals/deprecation.txt

     
    9999
    100100        * The ``no`` language code has been deprecated in favor of the ``nb``
    101101          language code.
     102   
     103    * 1.5
     104        * The ``mod_python`` request handler has been deprecated since the 1.3
     105          release. The ``mod_wsgi`` handler should be used instead.
    102106
    103107    * 2.0
    104108        * ``django.views.defaults.shortcut()``. This function has been moved
  • docs/index.txt

     
    152152    * **Deployment:**
    153153      :ref:`Overview <howto-deployment-index>` |
    154154      :ref:`Apache/mod_wsgi <howto-deployment-modwsgi>` |
    155       :ref:`Apache/mod_python <howto-deployment-modpython>` |
    156155      :ref:`FastCGI/SCGI/AJP <howto-deployment-fastcgi>` |
    157156      :ref:`Apache authentication <howto-apache-auth>` |
    158157      :ref:`Serving static files <howto-static-files>` |
  • docs/topics/install.txt

     
    3434need to set up Apache until you're ready to deploy Django in production.
    3535
    3636If you want to use Django on a production site, use Apache with `mod_wsgi`_.
    37 mod_wsgi is similar to mod_perl -- it embeds Python within Apache and loads
    38 Python code into memory when the server starts. Code stays in memory throughout
    39 the life of an Apache process, which leads to significant performance gains over
    40 other server arrangements. Make sure you have Apache installed, with the
    41 mod_wsgi module activated. Django will work with any version of Apache that
     37mod_wsgi can operate in one of two modes: an embedded mode and a daemon
     38mode. With the embedded mode, mod_wsgi is similar to mod_perl -- it embeds
     39Python within Apache and loads Python code into memory when the server starts.
     40Code stays in memory throughout the life of an Apache process, which leads to
     41significant performance gains over other server arrangements. With the daemon
     42mode, mod_wsgi spawns an independent daemon process that handles requests. The
     43daemon process can run as a different user than the webserver, possibly leading
     44to improved security, and the daemon process can be restarted without restarting
     45the entire Apache webserver, possibly making refreshing your codebase more
     46seamless. Consult the mod_wsgi documentation to determine which mode is right
     47for your setup. Make sure you have Apache installed, with the mod_wsgi module
     48activated. Django will work with any version of Apache that
    4249supports mod_wsgi.
    4350
    4451See :ref:`How to use Django with mod_wsgi <howto-deployment-modwsgi>` for
    4552information on how to configure mod_wsgi once you have it installed.
    4653
    4754If you can't use mod_wsgi for some reason, fear not: Django supports many other
    48 deployment options. A great second choice is :ref:`mod_python
    49 <howto-deployment-modpython>`, the predecessor to mod_wsgi. Additionally, Django
    50 follows the WSGI_ spec, which allows it to run on a variety of server platforms.
    51 See the `server-arrangements wiki page`_ for specific installation instructions
    52 for each platform.
     55deployment options. A great second choice is :ref:`FastCGI
     56<howto-deployment-fastcgi>`, perfect for using Django with servers other than
     57Apache. Additionally, Django follows the WSGI_ spec, which allows it to run on a
     58variety of server platforms. See the `server-arrangements wiki page`_ for
     59specific installation instructions for each platform.
    5360
    5461.. _Apache: http://httpd.apache.org/
    5562.. _mod_wsgi: http://code.google.com/p/modwsgi/
     
    257264   links. (Environment variables can be defined on Windows systems `from the
    258265   Control Panel`_.)
    259266
    260    .. admonition:: What about Apache and mod_python?
     267   .. admonition:: What about Apache and mod_wsgi?
    261268
    262269      If you take the approach of setting ``PYTHONPATH``, you'll need to
    263       remember to do the same thing in your Apache configuration once you
    264       deploy your production site. Do this by setting ``PythonPath`` in your
    265       Apache configuration file.
     270      remember to do the same thing in your WSGI application once you
     271      deploy your production site. Do this by appending to ``sys.path`` in your
     272      WSGI application.
    266273
    267274      More information about deployment is available, of course, in our
    268       :ref:`How to use Django with mod_python <howto-deployment-modpython>`
     275      :ref:`How to use Django with mod_wsgi <howto-deployment-modwsgi>`
    269276      documentation.
    270277
    2712784. On Unix-like systems, create a symbolic link to the file
  • docs/faq/admin.txt

     
    5151user from the request, the :meth:`ModelAdmin.queryset` and :meth:`ModelAdmin.has_change_permission`
    5252can be used to control the visibility and editability of objects in the admin.
    5353
    54 My admin-site CSS and images showed up fine using the development server, but they're not displaying when using mod_python.
     54My admin-site CSS and images showed up fine using the development server, but they're not displaying when using mod_wsgi.
    5555---------------------------------------------------------------------------------------------------------------------------
    5656
    57 See :ref:`serving the admin files <howto-deployment-modpython-serving-the-admin-files>`
    58 in the "How to use Django with mod_python" documentation.
     57See :ref:`serving the admin files <serving-the-admin-files>`
     58in the "How to use Django with mod_wsgi" documentation.
    5959
    6060My "list_filter" contains a ManyToManyField, but the filter doesn't display.
    6161----------------------------------------------------------------------------
  • docs/howto/deployment/index.txt

     
    1212   :maxdepth: 1
    1313   
    1414   modwsgi
    15    modpython
    1615   fastcgi
     16   How to use Django with Apache and mod_python (To be deprecated) <modpython>
    1717   
    1818If you're new to deploying Django and/or Python, we'd recommend you try
    1919:ref:`mod_wsgi <howto-deployment-modwsgi>` first. In most cases it'll be the easiest,
Back to Top