Skip to content

Commit

Permalink
Merge pull request #117 from johnMediaOnFire/johnmediaonfire/quicksta…
Browse files Browse the repository at this point in the history
…rt-urlconf-django3-pr

Update docs for recent Django urlpatterns.
  • Loading branch information
seocam committed Aug 7, 2020
2 parents d68dd94 + 784e1bd commit db7031b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
23 changes: 14 additions & 9 deletions docs/proxyview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ This document covers the views provided by ``revproxy.views`` and all it's publi

**Example urls.py**::

from django.urls import re_path

from revproxy.views import ProxyView

urlpatterns = patterns('',
url(r'^(?P<path>.*)$', ProxyView.as_view(upstream='http://example.com/')),
)
urlpatterns = [
re_path(r'(?P<path>.*)', ProxyView.as_view(upstream='http://example.com/')),
]


**Attributes**
Expand Down Expand Up @@ -109,6 +111,8 @@ This document covers the views provided by ``revproxy.views`` and all it's publi

**Example urls.py**::

from django.urls import re_path

from revproxy.views import DiazoProxyView

proxy_view = DiazoProxyView.as_view(
Expand All @@ -117,9 +121,9 @@ This document covers the views provided by ``revproxy.views`` and all it's publi
diazo_theme_template='base.html',
)

urlpatterns = patterns('',
url(r'^(?P<path>.*)$', proxy_view),
)
urlpatterns = [
re_path(r'(?P<path>.*)', proxy_view),
]


**Example base.html**
Expand Down Expand Up @@ -185,6 +189,7 @@ This document covers the views provided by ``revproxy.views`` and all it's publi

See the example bellow::

from django.urls import re_path

from revproxy.views import DiazoProxyView

Expand All @@ -199,9 +204,9 @@ This document covers the views provided by ``revproxy.views`` and all it's publi


# urls.py
urlpatterns = patterns('',
url(r'^(?P<path>.*)$', proxy_view),
)
urlpatterns = [
re_path(r'(?P<path>.*)', proxy_view),
]


And than the data will be available in the template as follow:
Expand Down
14 changes: 8 additions & 6 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,24 @@ Next, you'll need to create a View that extends ``revproxy.views.ProxyView`` and
And now add your view in the ``urls.py``:

.. code-block:: python
from django.urls import re_path
from myapp.views import TestProxyView
urlpatterns = patterns('',
url(r'^(?P<path>.*)$', TestProxyView.as_view()),
)
urlpatterns = [
re_path(r'(?P<path>.*)', TestProxyView.as_view()),
]
Alternatively you could just use the default ProxyView as follow:

.. code-block:: python
from django.urls import re_path
from revproxy.views import ProxyView
urlpatterns = patterns('',
url(r'^(?P<path>.*)$', ProxyView.as_view(upstream='http://example.com/')),
)
urlpatterns = [
re_path(r'(?P<path>.*)', ProxyView.as_view(upstream='http://example.com/')),
]
Expand Down

0 comments on commit db7031b

Please sign in to comment.