We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Remove "staff required" for aimmo pages when URL viewing restrictions are merged
Will require https://github.com/ocadotechnology/codeforlife-deploy-appengine/pull/35

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `players/urls.py`
Content:
```
1 from django.conf.urls import url
2 from django.views.generic import TemplateView
3 from django.contrib.auth.decorators import login_required
4 from django.contrib.admin.views.decorators import staff_member_required
5 
6 from players import views
7 
8 urlpatterns = [
9     url(r'^$', staff_member_required(TemplateView.as_view(template_name='players/home.html')), name='aimmo/home'),
10 
11     url(r'^program/$', staff_member_required(login_required(TemplateView.as_view(template_name='players/program.html'))), name='aimmo/program'),
12     url(r'^watch/$', staff_member_required(views.WatchView.as_view()), name='aimmo/watch'),
13     url(r'^statistics/$', staff_member_required(TemplateView.as_view(template_name='players/statistics.html')), name='aimmo/statistics'),
14 
15     url(r'^api/code/$', staff_member_required(views.code), name='aimmo/code'),
16     url(r'^api/games/$', views.games, name='aimmo/games'),
17 
18     url(r'^jsreverse/$', 'django_js_reverse.views.urls_js', name='aimmo/js_reverse'),  # TODO: Pull request to make django_js_reverse.urls
19 ]
20
```

Path: `example_project/example_project/settings.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 # Code for Life
3 #
4 # Copyright (C) 2015, Ocado Innovation Limited
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as
8 # published by the Free Software Foundation, either version 3 of the
9 # License, or (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU Affero General Public License for more details.
15 #
16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 #
19 # ADDITIONAL TERMS – Section 7 GNU General Public Licence
20 #
21 # This licence does not grant any right, title or interest in any “Ocado” logos,
22 # trade names or the trademark “Ocado” or any other trademarks or domain names
23 # owned by Ocado Innovation Limited or the Ocado group of companies or any other
24 # distinctive brand features of “Ocado” as may be secured from time to time. You
25 # must not distribute any modification of this program using the trademark
26 # “Ocado” or claim any affiliation or association with Ocado or its employees.
27 #
28 # You are not authorised to use the name Ocado (or any of its trade names) or
29 # the names of any author or contributor in advertising or for publicity purposes
30 # pertaining to the distribution of this program, without the prior written
31 # authorisation of Ocado.
32 #
33 # Any propagation, distribution or conveyance of this program must include this
34 # copyright notice and these terms. You must not misrepresent the origins of this
35 # program; modified versions of the program must be marked as such and not
36 # identified as the original program.
37 """Django settings for example_project project."""
38 import os
39 import subprocess
40 
41 DEBUG = True
42 
43 DATABASES = {
44     'default': {
45         'ENGINE': 'django.db.backends.sqlite3',  # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
46         'NAME': os.path.join(os.path.abspath(os.path.dirname(__file__)), 'db.sqlite3'),  # Or path to database file if using sqlite3.
47     }
48 }
49 
50 USE_I18N = True
51 USE_L10N = True
52 
53 TIME_ZONE = 'Europe/London'
54 LANGUAGE_CODE = 'en-gb'
55 STATIC_ROOT = os.path.join(os.path.dirname(__file__), 'static')
56 STATIC_URL = '/static/'
57 SECRET_KEY = 'not-a-secret'
58 
59 ROOT_URLCONF = 'django_autoconfig.autourlconf'
60 
61 WSGI_APPLICATION = 'example_project.wsgi.application'
62 
63 INSTALLED_APPS = (
64     'django.contrib.admin',
65     'players',
66 )
67 
68 LOGGING = {
69     'version': 1,
70     'disable_existing_loggers': False,
71     'filters': {
72         'require_debug_false': {
73             '()': 'django.utils.log.RequireDebugFalse'
74         }
75     },
76     'handlers': {
77         'console': {
78             'level': 'DEBUG',
79             'class': 'logging.StreamHandler'
80         },
81     },
82     'loggers': {
83         'views': {
84             'handlers': ['console'],
85             'level': 'DEBUG'
86         },
87     }
88 }
89 
90 
91 def get_url(game):
92     if os.environ.get('AIMMO_MODE', '') == 'minikube':
93         output = subprocess.check_output(['./test-bin/minikube', 'service', 'game-%s' % game, '--url'])
94         return (output.strip(), '/game/%s/socket.io' % game)
95     else:
96         return ('http://localhost:5000', '/socket.io')
97 
98 AIMMO_GAME_SERVER_LOCATION_FUNCTION = get_url
99 
100 try:
101     from example_project.local_settings import *  # pylint: disable=E0611
102 except ImportError:
103     pass
104 
105 from django_autoconfig import autoconfig
106 autoconfig.configure_settings(globals())
107
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/example_project/example_project/settings.py b/example_project/example_project/settings.py
--- a/example_project/example_project/settings.py
+++ b/example_project/example_project/settings.py
@@ -62,6 +62,8 @@
 
 INSTALLED_APPS = (
     'django.contrib.admin',
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
     'players',
 )
 
@@ -87,6 +89,16 @@
     }
 }
 
+LOGIN_URL = '/players/accounts/login/'
+
+MIDDLEWARE_CLASSES = [
+   'django.contrib.sessions.middleware.SessionMiddleware',
+   'django.middleware.locale.LocaleMiddleware',
+   'django.middleware.common.CommonMiddleware',
+   'django.middleware.csrf.CsrfViewMiddleware',
+   'django.contrib.auth.middleware.AuthenticationMiddleware',
+   'django.contrib.messages.middleware.MessageMiddleware',
+]
 
 def get_url(game):
     if os.environ.get('AIMMO_MODE', '') == 'minikube':
diff --git a/players/urls.py b/players/urls.py
--- a/players/urls.py
+++ b/players/urls.py
@@ -1,18 +1,19 @@
 from django.conf.urls import url
 from django.views.generic import TemplateView
+from django.contrib.auth import views as auth_views
 from django.contrib.auth.decorators import login_required
-from django.contrib.admin.views.decorators import staff_member_required
 
 from players import views
 
 urlpatterns = [
-    url(r'^$', staff_member_required(TemplateView.as_view(template_name='players/home.html')), name='aimmo/home'),
+    url(r'^$', TemplateView.as_view(template_name='players/home.html'), name='aimmo/home'),
 
-    url(r'^program/$', staff_member_required(login_required(TemplateView.as_view(template_name='players/program.html'))), name='aimmo/program'),
-    url(r'^watch/$', staff_member_required(views.WatchView.as_view()), name='aimmo/watch'),
-    url(r'^statistics/$', staff_member_required(TemplateView.as_view(template_name='players/statistics.html')), name='aimmo/statistics'),
+    url(r'^program/$', login_required(TemplateView.as_view(template_name='players/program.html')), name='aimmo/program'),
+    url(r'^accounts/login/$', auth_views.login),
+    url(r'^watch/$', views.WatchView.as_view(), name='aimmo/watch'),
+    url(r'^statistics/$', TemplateView.as_view(template_name='players/statistics.html'), name='aimmo/statistics'),
 
-    url(r'^api/code/$', staff_member_required(views.code), name='aimmo/code'),
+    url(r'^api/code/$', views.code, name='aimmo/code'),
     url(r'^api/games/$', views.games, name='aimmo/games'),
 
     url(r'^jsreverse/$', 'django_js_reverse.views.urls_js', name='aimmo/js_reverse'),  # TODO: Pull request to make django_js_reverse.urls

{"golden_diff": "diff --git a/example_project/example_project/settings.py b/example_project/example_project/settings.py\n--- a/example_project/example_project/settings.py\n+++ b/example_project/example_project/settings.py\n@@ -62,6 +62,8 @@\n \n INSTALLED_APPS = (\n     'django.contrib.admin',\n+    'django.contrib.auth',\n+    'django.contrib.contenttypes',\n     'players',\n )\n \n@@ -87,6 +89,16 @@\n     }\n }\n \n+LOGIN_URL = '/players/accounts/login/'\n+\n+MIDDLEWARE_CLASSES = [\n+   'django.contrib.sessions.middleware.SessionMiddleware',\n+   'django.middleware.locale.LocaleMiddleware',\n+   'django.middleware.common.CommonMiddleware',\n+   'django.middleware.csrf.CsrfViewMiddleware',\n+   'django.contrib.auth.middleware.AuthenticationMiddleware',\n+   'django.contrib.messages.middleware.MessageMiddleware',\n+]\n \n def get_url(game):\n     if os.environ.get('AIMMO_MODE', '') == 'minikube':\ndiff --git a/players/urls.py b/players/urls.py\n--- a/players/urls.py\n+++ b/players/urls.py\n@@ -1,18 +1,19 @@\n from django.conf.urls import url\n from django.views.generic import TemplateView\n+from django.contrib.auth import views as auth_views\n from django.contrib.auth.decorators import login_required\n-from django.contrib.admin.views.decorators import staff_member_required\n \n from players import views\n \n urlpatterns = [\n-    url(r'^$', staff_member_required(TemplateView.as_view(template_name='players/home.html')), name='aimmo/home'),\n+    url(r'^$', TemplateView.as_view(template_name='players/home.html'), name='aimmo/home'),\n \n-    url(r'^program/$', staff_member_required(login_required(TemplateView.as_view(template_name='players/program.html'))), name='aimmo/program'),\n-    url(r'^watch/$', staff_member_required(views.WatchView.as_view()), name='aimmo/watch'),\n-    url(r'^statistics/$', staff_member_required(TemplateView.as_view(template_name='players/statistics.html')), name='aimmo/statistics'),\n+    url(r'^program/$', login_required(TemplateView.as_view(template_name='players/program.html')), name='aimmo/program'),\n+    url(r'^accounts/login/$', auth_views.login),\n+    url(r'^watch/$', views.WatchView.as_view(), name='aimmo/watch'),\n+    url(r'^statistics/$', TemplateView.as_view(template_name='players/statistics.html'), name='aimmo/statistics'),\n \n-    url(r'^api/code/$', staff_member_required(views.code), name='aimmo/code'),\n+    url(r'^api/code/$', views.code, name='aimmo/code'),\n     url(r'^api/games/$', views.games, name='aimmo/games'),\n \n     url(r'^jsreverse/$', 'django_js_reverse.views.urls_js', name='aimmo/js_reverse'),  # TODO: Pull request to make django_js_reverse.urls\n", "issue": "Remove \"staff required\" for aimmo pages when URL viewing restrictions are merged\nWill require https://github.com/ocadotechnology/codeforlife-deploy-appengine/pull/35\n", "before_files": [{"content": "from django.conf.urls import url\nfrom django.views.generic import TemplateView\nfrom django.contrib.auth.decorators import login_required\nfrom django.contrib.admin.views.decorators import staff_member_required\n\nfrom players import views\n\nurlpatterns = [\n    url(r'^$', staff_member_required(TemplateView.as_view(template_name='players/home.html')), name='aimmo/home'),\n\n    url(r'^program/$', staff_member_required(login_required(TemplateView.as_view(template_name='players/program.html'))), name='aimmo/program'),\n    url(r'^watch/$', staff_member_required(views.WatchView.as_view()), name='aimmo/watch'),\n    url(r'^statistics/$', staff_member_required(TemplateView.as_view(template_name='players/statistics.html')), name='aimmo/statistics'),\n\n    url(r'^api/code/$', staff_member_required(views.code), name='aimmo/code'),\n    url(r'^api/games/$', views.games, name='aimmo/games'),\n\n    url(r'^jsreverse/$', 'django_js_reverse.views.urls_js', name='aimmo/js_reverse'),  # TODO: Pull request to make django_js_reverse.urls\n]\n", "path": "players/urls.py"}, {"content": "# -*- coding: utf-8 -*-\n# Code for Life\n#\n# Copyright (C) 2015, Ocado Innovation Limited\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as\n# published by the Free Software Foundation, either version 3 of the\n# License, or (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU Affero General Public License for more details.\n#\n# You should have received a copy of the GNU Affero General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n#\n# ADDITIONAL TERMS \u2013 Section 7 GNU General Public Licence\n#\n# This licence does not grant any right, title or interest in any \u201cOcado\u201d logos,\n# trade names or the trademark \u201cOcado\u201d or any other trademarks or domain names\n# owned by Ocado Innovation Limited or the Ocado group of companies or any other\n# distinctive brand features of \u201cOcado\u201d as may be secured from time to time. You\n# must not distribute any modification of this program using the trademark\n# \u201cOcado\u201d or claim any affiliation or association with Ocado or its employees.\n#\n# You are not authorised to use the name Ocado (or any of its trade names) or\n# the names of any author or contributor in advertising or for publicity purposes\n# pertaining to the distribution of this program, without the prior written\n# authorisation of Ocado.\n#\n# Any propagation, distribution or conveyance of this program must include this\n# copyright notice and these terms. You must not misrepresent the origins of this\n# program; modified versions of the program must be marked as such and not\n# identified as the original program.\n\"\"\"Django settings for example_project project.\"\"\"\nimport os\nimport subprocess\n\nDEBUG = True\n\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.sqlite3',  # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.\n        'NAME': os.path.join(os.path.abspath(os.path.dirname(__file__)), 'db.sqlite3'),  # Or path to database file if using sqlite3.\n    }\n}\n\nUSE_I18N = True\nUSE_L10N = True\n\nTIME_ZONE = 'Europe/London'\nLANGUAGE_CODE = 'en-gb'\nSTATIC_ROOT = os.path.join(os.path.dirname(__file__), 'static')\nSTATIC_URL = '/static/'\nSECRET_KEY = 'not-a-secret'\n\nROOT_URLCONF = 'django_autoconfig.autourlconf'\n\nWSGI_APPLICATION = 'example_project.wsgi.application'\n\nINSTALLED_APPS = (\n    'django.contrib.admin',\n    'players',\n)\n\nLOGGING = {\n    'version': 1,\n    'disable_existing_loggers': False,\n    'filters': {\n        'require_debug_false': {\n            '()': 'django.utils.log.RequireDebugFalse'\n        }\n    },\n    'handlers': {\n        'console': {\n            'level': 'DEBUG',\n            'class': 'logging.StreamHandler'\n        },\n    },\n    'loggers': {\n        'views': {\n            'handlers': ['console'],\n            'level': 'DEBUG'\n        },\n    }\n}\n\n\ndef get_url(game):\n    if os.environ.get('AIMMO_MODE', '') == 'minikube':\n        output = subprocess.check_output(['./test-bin/minikube', 'service', 'game-%s' % game, '--url'])\n        return (output.strip(), '/game/%s/socket.io' % game)\n    else:\n        return ('http://localhost:5000', '/socket.io')\n\nAIMMO_GAME_SERVER_LOCATION_FUNCTION = get_url\n\ntry:\n    from example_project.local_settings import *  # pylint: disable=E0611\nexcept ImportError:\n    pass\n\nfrom django_autoconfig import autoconfig\nautoconfig.configure_settings(globals())\n", "path": "example_project/example_project/settings.py"}], "after_files": [{"content": "from django.conf.urls import url\nfrom django.views.generic import TemplateView\nfrom django.contrib.auth import views as auth_views\nfrom django.contrib.auth.decorators import login_required\n\nfrom players import views\n\nurlpatterns = [\n    url(r'^$', TemplateView.as_view(template_name='players/home.html'), name='aimmo/home'),\n\n    url(r'^program/$', login_required(TemplateView.as_view(template_name='players/program.html')), name='aimmo/program'),\n    url(r'^accounts/login/$', auth_views.login),\n    url(r'^watch/$', views.WatchView.as_view(), name='aimmo/watch'),\n    url(r'^statistics/$', TemplateView.as_view(template_name='players/statistics.html'), name='aimmo/statistics'),\n\n    url(r'^api/code/$', views.code, name='aimmo/code'),\n    url(r'^api/games/$', views.games, name='aimmo/games'),\n\n    url(r'^jsreverse/$', 'django_js_reverse.views.urls_js', name='aimmo/js_reverse'),  # TODO: Pull request to make django_js_reverse.urls\n]\n", "path": "players/urls.py"}, {"content": "# -*- coding: utf-8 -*-\n# Code for Life\n#\n# Copyright (C) 2015, Ocado Innovation Limited\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as\n# published by the Free Software Foundation, either version 3 of the\n# License, or (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU Affero General Public License for more details.\n#\n# You should have received a copy of the GNU Affero General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n#\n# ADDITIONAL TERMS \u2013 Section 7 GNU General Public Licence\n#\n# This licence does not grant any right, title or interest in any \u201cOcado\u201d logos,\n# trade names or the trademark \u201cOcado\u201d or any other trademarks or domain names\n# owned by Ocado Innovation Limited or the Ocado group of companies or any other\n# distinctive brand features of \u201cOcado\u201d as may be secured from time to time. You\n# must not distribute any modification of this program using the trademark\n# \u201cOcado\u201d or claim any affiliation or association with Ocado or its employees.\n#\n# You are not authorised to use the name Ocado (or any of its trade names) or\n# the names of any author or contributor in advertising or for publicity purposes\n# pertaining to the distribution of this program, without the prior written\n# authorisation of Ocado.\n#\n# Any propagation, distribution or conveyance of this program must include this\n# copyright notice and these terms. You must not misrepresent the origins of this\n# program; modified versions of the program must be marked as such and not\n# identified as the original program.\n\"\"\"Django settings for example_project project.\"\"\"\nimport os\nimport subprocess\n\nDEBUG = True\n\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.sqlite3',  # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.\n        'NAME': os.path.join(os.path.abspath(os.path.dirname(__file__)), 'db.sqlite3'),  # Or path to database file if using sqlite3.\n    }\n}\n\nUSE_I18N = True\nUSE_L10N = True\n\nTIME_ZONE = 'Europe/London'\nLANGUAGE_CODE = 'en-gb'\nSTATIC_ROOT = os.path.join(os.path.dirname(__file__), 'static')\nSTATIC_URL = '/static/'\nSECRET_KEY = 'not-a-secret'\n\nROOT_URLCONF = 'django_autoconfig.autourlconf'\n\nWSGI_APPLICATION = 'example_project.wsgi.application'\n\nINSTALLED_APPS = (\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'django.contrib.contenttypes',\n    'players',\n)\n\nLOGGING = {\n    'version': 1,\n    'disable_existing_loggers': False,\n    'filters': {\n        'require_debug_false': {\n            '()': 'django.utils.log.RequireDebugFalse'\n        }\n    },\n    'handlers': {\n        'console': {\n            'level': 'DEBUG',\n            'class': 'logging.StreamHandler'\n        },\n    },\n    'loggers': {\n        'views': {\n            'handlers': ['console'],\n            'level': 'DEBUG'\n        },\n    }\n}\n\nLOGIN_URL = '/players/accounts/login/'\n\nMIDDLEWARE_CLASSES = [\n   'django.contrib.sessions.middleware.SessionMiddleware',\n   'django.middleware.locale.LocaleMiddleware',\n   'django.middleware.common.CommonMiddleware',\n   'django.middleware.csrf.CsrfViewMiddleware',\n   'django.contrib.auth.middleware.AuthenticationMiddleware',\n   'django.contrib.messages.middleware.MessageMiddleware',\n]\n\ndef get_url(game):\n    if os.environ.get('AIMMO_MODE', '') == 'minikube':\n        output = subprocess.check_output(['./test-bin/minikube', 'service', 'game-%s' % game, '--url'])\n        return (output.strip(), '/game/%s/socket.io' % game)\n    else:\n        return ('http://localhost:5000', '/socket.io')\n\nAIMMO_GAME_SERVER_LOCATION_FUNCTION = get_url\n\ntry:\n    from example_project.local_settings import *  # pylint: disable=E0611\nexcept ImportError:\n    pass\n\nfrom django_autoconfig import autoconfig\nautoconfig.configure_settings(globals())\n", "path": "example_project/example_project/settings.py"}]}