From 2ae8a037d226be170de61aa7dbd00ae52162baaf Mon Sep 17 00:00:00 2001 From: Michael Samoylov Date: Mon, 13 Jun 2016 23:14:26 +0300 Subject: [PATCH 1/4] Added django-robots integration --- README.rst | 1 + cookiecutter.json | 1 + {{cookiecutter.project_slug}}/config/settings/common.py | 8 ++++++++ {{cookiecutter.project_slug}}/config/urls.py | 4 +++- {{cookiecutter.project_slug}}/requirements/base.txt | 5 +++++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 5c6613775..85f9cdc72 100644 --- a/README.rst +++ b/README.rst @@ -72,6 +72,7 @@ Optional Integrations .. _docker-compose: https://www.github.com/docker/compose .. _Opbeat: https://opbeat.com/ .. _PythonAnywhere: https://www.pythonanywhere.com/ +.. _django-robots: https://github.com/jazzband/django-robots/ Constraints diff --git a/cookiecutter.json b/cookiecutter.json index 9b21f3cdc..ca7dd583c 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -11,6 +11,7 @@ "use_celery": "n", "use_mailhog": "n", "use_sentry_for_error_reporting": "y", + "use_robots": "y", "use_opbeat": "n", "use_pycharm": "n", "windows": "n", diff --git a/{{cookiecutter.project_slug}}/config/settings/common.py b/{{cookiecutter.project_slug}}/config/settings/common.py index 3e11ee433..c0805b705 100644 --- a/{{cookiecutter.project_slug}}/config/settings/common.py +++ b/{{cookiecutter.project_slug}}/config/settings/common.py @@ -39,6 +39,9 @@ THIRD_PARTY_APPS = ( 'allauth', # registration 'allauth.account', # registration 'allauth.socialaccount', # registration + {% if cookiecutter.use_robots == "y" %} + 'robots', # robots.txt + {% endif %} ) # Apps specific for this project go here. @@ -236,4 +239,9 @@ BROKER_URL = env('CELERY_BROKER_URL', default='django://') # Location of root django.contrib.admin URL, use {% raw %}{% url 'admin:index' %}{% endraw %} ADMIN_URL = r'^admin/' +{% if cookiecutter.use_robots == "y" %} +# django-robots +ROBOTS_CACHE_TIMEOUT = 60 * 60 # 1 hour +{% endif %} + # Your common stuff: Below this line define 3rd party library settings diff --git a/{{cookiecutter.project_slug}}/config/urls.py b/{{cookiecutter.project_slug}}/config/urls.py index f3a621127..74043d48d 100644 --- a/{{cookiecutter.project_slug}}/config/urls.py +++ b/{{cookiecutter.project_slug}}/config/urls.py @@ -18,7 +18,9 @@ urlpatterns = [ # User management url(r'^users/', include('{{ cookiecutter.project_slug }}.users.urls', namespace='users')), url(r'^accounts/', include('allauth.urls')), - + {% if cookiecutter.use_robots == "y" %} + url(r'^robots\.txt$', include('robots.urls')), + {% endif %} # Your stuff: custom urls includes go here diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 5450a0988..d7289476b 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -54,4 +54,9 @@ redis>=2.10.0 celery==3.1.23 {% endif %} +{% if cookiecutter.use_robots == "y" %} +# django-robots +django-robots==2.0 +{% endif %} + # Your custom requirements go here From 81022541d2bced245815de9bf3ee2d6ac62335f4 Mon Sep 17 00:00:00 2001 From: Michael Samoylov Date: Mon, 13 Jun 2016 23:14:26 +0300 Subject: [PATCH 2/4] Added django-robots integration --- README.rst | 1 + cookiecutter.json | 1 + {{cookiecutter.project_slug}}/config/settings/common.py | 8 ++++++++ {{cookiecutter.project_slug}}/config/urls.py | 4 +++- {{cookiecutter.project_slug}}/requirements/base.txt | 5 +++++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 5c6613775..85f9cdc72 100644 --- a/README.rst +++ b/README.rst @@ -72,6 +72,7 @@ Optional Integrations .. _docker-compose: https://www.github.com/docker/compose .. _Opbeat: https://opbeat.com/ .. _PythonAnywhere: https://www.pythonanywhere.com/ +.. _django-robots: https://github.com/jazzband/django-robots/ Constraints diff --git a/cookiecutter.json b/cookiecutter.json index 9b21f3cdc..ca7dd583c 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -11,6 +11,7 @@ "use_celery": "n", "use_mailhog": "n", "use_sentry_for_error_reporting": "y", + "use_robots": "y", "use_opbeat": "n", "use_pycharm": "n", "windows": "n", diff --git a/{{cookiecutter.project_slug}}/config/settings/common.py b/{{cookiecutter.project_slug}}/config/settings/common.py index 3e11ee433..c0805b705 100644 --- a/{{cookiecutter.project_slug}}/config/settings/common.py +++ b/{{cookiecutter.project_slug}}/config/settings/common.py @@ -39,6 +39,9 @@ THIRD_PARTY_APPS = ( 'allauth', # registration 'allauth.account', # registration 'allauth.socialaccount', # registration + {% if cookiecutter.use_robots == "y" %} + 'robots', # robots.txt + {% endif %} ) # Apps specific for this project go here. @@ -236,4 +239,9 @@ BROKER_URL = env('CELERY_BROKER_URL', default='django://') # Location of root django.contrib.admin URL, use {% raw %}{% url 'admin:index' %}{% endraw %} ADMIN_URL = r'^admin/' +{% if cookiecutter.use_robots == "y" %} +# django-robots +ROBOTS_CACHE_TIMEOUT = 60 * 60 # 1 hour +{% endif %} + # Your common stuff: Below this line define 3rd party library settings diff --git a/{{cookiecutter.project_slug}}/config/urls.py b/{{cookiecutter.project_slug}}/config/urls.py index f3a621127..74043d48d 100644 --- a/{{cookiecutter.project_slug}}/config/urls.py +++ b/{{cookiecutter.project_slug}}/config/urls.py @@ -18,7 +18,9 @@ urlpatterns = [ # User management url(r'^users/', include('{{ cookiecutter.project_slug }}.users.urls', namespace='users')), url(r'^accounts/', include('allauth.urls')), - + {% if cookiecutter.use_robots == "y" %} + url(r'^robots\.txt$', include('robots.urls')), + {% endif %} # Your stuff: custom urls includes go here diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 5450a0988..d7289476b 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -54,4 +54,9 @@ redis>=2.10.0 celery==3.1.23 {% endif %} +{% if cookiecutter.use_robots == "y" %} +# django-robots +django-robots==2.0 +{% endif %} + # Your custom requirements go here From d83493890c1ab5507d2c38f24a1a72e27904236c Mon Sep 17 00:00:00 2001 From: Michael Samoylov Date: Tue, 14 Jun 2016 13:26:12 +0300 Subject: [PATCH 3/4] Fixed failing flake8 tests --- {{cookiecutter.project_slug}}/config/settings/common.py | 3 --- .../config/settings/production.py | 4 ++++ {{cookiecutter.project_slug}}/config/urls.py | 8 +++++--- {{cookiecutter.project_slug}}/requirements/base.txt | 5 ----- {{cookiecutter.project_slug}}/requirements/production.txt | 5 +++++ 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/common.py b/{{cookiecutter.project_slug}}/config/settings/common.py index c0805b705..eb5941b09 100644 --- a/{{cookiecutter.project_slug}}/config/settings/common.py +++ b/{{cookiecutter.project_slug}}/config/settings/common.py @@ -39,9 +39,6 @@ THIRD_PARTY_APPS = ( 'allauth', # registration 'allauth.account', # registration 'allauth.socialaccount', # registration - {% if cookiecutter.use_robots == "y" %} - 'robots', # robots.txt - {% endif %} ) # Apps specific for this project go here. diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index e2bac6c9e..75eb8d366 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -299,4 +299,8 @@ LOGGING = { # Custom Admin URL, use {% raw %}{% url 'admin:index' %}{% endraw %} ADMIN_URL = env('DJANGO_ADMIN_URL') +{% if cookiecutter.use_robots == "y" %} +INSTALLED_APPS += ('robots',) # robots.txt +{% endif %} + # Your production stuff: Below this line define 3rd party library settings diff --git a/{{cookiecutter.project_slug}}/config/urls.py b/{{cookiecutter.project_slug}}/config/urls.py index 74043d48d..bf75cac1e 100644 --- a/{{cookiecutter.project_slug}}/config/urls.py +++ b/{{cookiecutter.project_slug}}/config/urls.py @@ -18,9 +18,7 @@ urlpatterns = [ # User management url(r'^users/', include('{{ cookiecutter.project_slug }}.users.urls', namespace='users')), url(r'^accounts/', include('allauth.urls')), - {% if cookiecutter.use_robots == "y" %} - url(r'^robots\.txt$', include('robots.urls')), - {% endif %} + # Your stuff: custom urls includes go here @@ -35,3 +33,7 @@ if settings.DEBUG: url(r'^404/$', default_views.page_not_found, kwargs={'exception': Exception('Page not Found')}), url(r'^500/$', default_views.server_error), ] + +{% if cookiecutter.use_robots == "y" %} +urlpatterns += [url(r'^robots\.txt$', include('robots.urls'))] +{% endif %} diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index d7289476b..5450a0988 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -54,9 +54,4 @@ redis>=2.10.0 celery==3.1.23 {% endif %} -{% if cookiecutter.use_robots == "y" %} -# django-robots -django-robots==2.0 -{% endif %} - # Your custom requirements go here diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 2db9d2678..3cd571bb9 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -37,3 +37,8 @@ raven # ----------------------------------------- opbeat {%- endif %} + +{% if cookiecutter.use_robots == "y" %} +# django-robots +django-robots==2.0 +{% endif %} From 57c4c18deb4e26bb8f566e13ceb8f9a20f89a44c Mon Sep 17 00:00:00 2001 From: Michael Samoylov Date: Tue, 14 Jun 2016 14:42:14 +0300 Subject: [PATCH 4/4] Attempting to fix failing tests --- {{cookiecutter.project_slug}}/config/settings/common.py | 7 ++++--- .../config/settings/production.py | 4 ---- {{cookiecutter.project_slug}}/config/urls.py | 8 ++++---- {{cookiecutter.project_slug}}/requirements/base.txt | 5 +++++ {{cookiecutter.project_slug}}/requirements/production.txt | 5 ----- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/common.py b/{{cookiecutter.project_slug}}/config/settings/common.py index eb5941b09..c2a2ce4a5 100644 --- a/{{cookiecutter.project_slug}}/config/settings/common.py +++ b/{{cookiecutter.project_slug}}/config/settings/common.py @@ -39,6 +39,9 @@ THIRD_PARTY_APPS = ( 'allauth', # registration 'allauth.account', # registration 'allauth.socialaccount', # registration + {% if cookiecutter.use_robots == "y" -%} + 'robots', # robots.txt + {%- endif %} ) # Apps specific for this project go here. @@ -235,10 +238,8 @@ BROKER_URL = env('CELERY_BROKER_URL', default='django://') # Location of root django.contrib.admin URL, use {% raw %}{% url 'admin:index' %}{% endraw %} ADMIN_URL = r'^admin/' - -{% if cookiecutter.use_robots == "y" %} +{% if cookiecutter.use_robots == "y" -%} # django-robots ROBOTS_CACHE_TIMEOUT = 60 * 60 # 1 hour {% endif %} - # Your common stuff: Below this line define 3rd party library settings diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 75eb8d366..e2bac6c9e 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -299,8 +299,4 @@ LOGGING = { # Custom Admin URL, use {% raw %}{% url 'admin:index' %}{% endraw %} ADMIN_URL = env('DJANGO_ADMIN_URL') -{% if cookiecutter.use_robots == "y" %} -INSTALLED_APPS += ('robots',) # robots.txt -{% endif %} - # Your production stuff: Below this line define 3rd party library settings diff --git a/{{cookiecutter.project_slug}}/config/urls.py b/{{cookiecutter.project_slug}}/config/urls.py index bf75cac1e..917f0e994 100644 --- a/{{cookiecutter.project_slug}}/config/urls.py +++ b/{{cookiecutter.project_slug}}/config/urls.py @@ -19,6 +19,10 @@ urlpatterns = [ url(r'^users/', include('{{ cookiecutter.project_slug }}.users.urls', namespace='users')), url(r'^accounts/', include('allauth.urls')), + {% if cookiecutter.use_robots == "y" -%} + url(r'^robots\.txt$', include('robots.urls')), + {%- endif %} + # Your stuff: custom urls includes go here @@ -33,7 +37,3 @@ if settings.DEBUG: url(r'^404/$', default_views.page_not_found, kwargs={'exception': Exception('Page not Found')}), url(r'^500/$', default_views.server_error), ] - -{% if cookiecutter.use_robots == "y" %} -urlpatterns += [url(r'^robots\.txt$', include('robots.urls'))] -{% endif %} diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 5450a0988..ba7c6a656 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -54,4 +54,9 @@ redis>=2.10.0 celery==3.1.23 {% endif %} +{% if cookiecutter.use_robots == "y" -%} +# django-robots +django-robots==2.0 +{%- endif %} + # Your custom requirements go here diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 3cd571bb9..2db9d2678 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -37,8 +37,3 @@ raven # ----------------------------------------- opbeat {%- endif %} - -{% if cookiecutter.use_robots == "y" %} -# django-robots -django-robots==2.0 -{% endif %}