Installation & configuration¶
Requirements¶
- Python
- Django
- Requests
Installation¶
$ pip install dproxy
Next, you need to add “dproxy” to the INSTALLED_APPS list in your Django settings module (typically settings.py):
INSTALLED_APPS = (
...
'dproxy',
)
Configuration¶
The core of DProxy is a class-based Django view, dproxy.views.DProxy.
To use DProxy, you create an entry in your urls.py that forwards requests to the DProxy view class, e.g.:
from dproxy.views import DProxy
urlpatterns += patterns('',
(r'^proxy/(?P<url>.*)$', DProxy.as_view(base_url='http://www.python.org')),
)
Given the above url config, request matching /proxy/<any-url> will be handled by the configured DProxy view instance and forwarded to http://www.python.org/<any-url>.