Ticket #10328: urls.diff

File urls.diff, 1.3 KB (added by leovitch, 16 years ago)

diff for docs/topics/http/urls.txt

  • docs/topics/http/urls.txt

     
    640640The :func:`django.db.models.permalink` decorator is useful for writing short
    641641methods that return a full URL path. For example, a model's
    642642``get_absolute_url()`` method. See :func:`django.db.models.permalink` for more.
     643
     644get_script_prefix()
     645-------------------
     646
     647.. versionadded:: 1.0
     648
     649Normally, you should always use
     650:func:`~django.core.urlresolvers.reverse` or
     651:func:`~django.db.models.permalink` to define URLs
     652within your application.
     653However, if your application constructs
     654part of the URL hierarchy itself you may occasionally
     655need to generate URLs.
     656In that case, you need to be able to find the base URL
     657of the Django project within its web server
     658(normally, :func:`~django.core.urlresolvers.reverse`
     659takes care of this for you).
     660In that case, you can call ``get_script_prefix()``,
     661which will return the script prefix portion of the URL
     662for your Django project.
     663If your Django project is at the root of its webserver,
     664this is always ``"/"``, but it can be changed, for instance
     665by using the ``django.root`` (see
     666:ref:`How to use Django with Apache and mod_python <howto-deployment-modpython>`).
     667
Back to Top