1
1
=========================
2
- django-robots
2
+ django-url- robots
3
3
=========================
4
4
5
5
``Django `` ``robots.txt `` generator. Based on using decorated ``django.conf.urls.url ``.
@@ -8,44 +8,44 @@ It gets ``urlpatterns`` and replaces ambiguous parts by ``*``.
8
8
Installation & Usage
9
9
=========================
10
10
11
- The recommended way to install django-robots is with `pip <http://pypi.python.org/pypi/pip >`_
11
+ The recommended way to install django-url- robots is with `pip <http://pypi.python.org/pypi/pip >`_
12
12
13
13
1. Install from PyPI with ``easy_install `` or ``pip ``::
14
14
15
- pip install git+https://github.com/valeriansaliou/ django-robots
15
+ pip install django-url -robots
16
16
17
- 2. Add ``'robots ' `` to your ``INSTALLED_APPS ``::
17
+ 2. Add ``'url_robots ' `` to your ``INSTALLED_APPS ``::
18
18
19
19
INSTALLED_APPS = (
20
20
...
21
- 'robots ',
21
+ 'url_robots ',
22
22
...
23
23
)
24
24
25
- 3. Add robots view to your root URLconf::
25
+ 3. Add url_robots view to your root URLconf::
26
26
27
- urlpatterns += patterns('',
28
- url(r'^robots\.txt$', ' robots.views.robots_txt' ),
29
- )
27
+ urlpatterns += [
28
+ url(r'^robots\.txt$', robots.views.robots_txt),
29
+ ]
30
30
31
31
4. Describe rules by boolean keyword argument ``robots_allow `` using for it ``robots.utils.url `` instead ``django.conf.urls.url ``::
32
32
33
- from robots .utils import url
33
+ from url_robots .utils import url
34
34
35
- urlpatterns += patterns('',
36
- url('^profile/private$', 'view' , robots_allow=False),
37
- )
35
+ urlpatterns += [
36
+ url('^profile/private$', views.some_view , robots_allow=False),
37
+ ]
38
38
39
- ``django-robots `` tested with ``Django-1.3 ``. Encodes unicode characters by percent-encoding.
39
+ ``django-url- robots `` tested with ``Django-1.3 ``. Encodes unicode characters by percent-encoding.
40
40
41
41
Settings
42
42
====================
43
43
44
44
In this moment there are only one option to define template of ``robots.txt `` file::
45
45
46
- urlpatterns += patterns('',
47
- url(r'^robots\.txt$', 'robots .views.robots_txt' , {'template': 'my_awesome_robots_template.txt'}),
48
- )
46
+ urlpatterns += [
47
+ url(r'^robots\.txt$', url_robots .views.robots_txt, {'template': 'my_awesome_robots_template.txt'}),
48
+ ]
49
49
50
50
Example
51
51
===================
@@ -57,23 +57,22 @@ robots_template.txt::
57
57
58
58
urls.py::
59
59
60
- from django.conf.urls import patterns, include
60
+ from django.conf.urls import include
61
61
62
- urlpatterns = patterns('',
62
+ urlpatterns = [
63
63
url(r'^profile', include('robots.tests.urls_profile')),
64
- )
64
+ ]
65
65
66
66
urls_profile.py::
67
67
68
- from django.conf.urls import patterns
69
- from robots.utils import url
68
+ from url_robots.utils import url
70
69
71
- urlpatterns = patterns('',
72
- url(r'^s$', 'view' , name='profiles', robots_allow=True),
73
- url(r'^/(?P<nick>\w+)$', 'view' ),
74
- url(r'^/(?P<nick>\w+)/private', 'view' , name='profile_private', robots_allow=False),
75
- url(r'^/(?P<nick>\w+)/public', 'view' , name='profile_public', robots_allow=True),
76
- )
70
+ urlpatterns = [
71
+ url(r'^s$', views.some_view , name='profiles', robots_allow=True),
72
+ url(r'^/(?P<nick>\w+)$', views.some_view ),
73
+ url(r'^/(?P<nick>\w+)/private', views.some_view , name='profile_private', robots_allow=False),
74
+ url(r'^/(?P<nick>\w+)/public', views.some_view , name='profile_public', robots_allow=True),
75
+ ]
77
76
78
77
Resulting robots.txt::
79
78
0 commit comments