prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Limitations on SENTRY_KEY not documented
  I assumed that SENTRY_KEY was just any random string that should be unique to a deployment and kept secret (ie, serving a similar purpose to django's SECRET_KEY) so I generated a random string to use there. 
  
  It turns out that it's used in a URL for the feeds:
  
  ```
  url(r'^feeds/%s/messages.xml$' % KEY, MessageFeed(), name='sentry-feed-messages'),
  ```
  
  (in sentry.urls)
  
  Mine happened to have an '[' in it which caused a very confusing error about an unterminated regex. 
  
  It should be documented that SENTRY_KEY will make it into a URL (and further that django will try to then parse it as a regexp when trying to do reverse lookups) and thus can't have most punctuation. 
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `sentry/urls.py`
  Content:
  ```
  1 import os
  2 
  3 from django.conf.urls.defaults import *
  4 
  5 from sentry.conf import KEY
  6 from sentry import views
  7 from sentry.feeds import MessageFeed, SummaryFeed
  8 
  9 SENTRY_ROOT = os.path.dirname(__file__) 
  10 
  11 urlpatterns = patterns('',
  12     url(r'^_media/(?P<path>.*)$', 'django.views.static.serve',
  13         {'document_root': os.path.join(SENTRY_ROOT, 'media')}, name='sentry-media'),
  14 
  15     # Feeds
  16 
  17     url(r'^feeds/%s/messages.xml$' % KEY, MessageFeed(), name='sentry-feed-messages'),
  18     url(r'^feeds/%s/summaries.xml$' % KEY, SummaryFeed(), name='sentry-feed-summaries'),
  19 
  20     # JS and API
  21 
  22     url(r'^jsapi/$', views.ajax_handler, name='sentry-ajax'),
  23     url(r'^store/$', views.store, name='sentry-store'),
  24     
  25     # Normal views
  26 
  27     url(r'^login$', views.login, name='sentry-login'),
  28     url(r'^logout$', views.logout, name='sentry-logout'),
  29     url(r'^group/(\d+)$', views.group, name='sentry-group'),
  30     url(r'^group/(\d+)/messages$', views.group_message_list, name='sentry-group-messages'),
  31     url(r'^group/(\d+)/messages/(\d+)$', views.group_message_details, name='sentry-group-message'),
  32     url(r'^group/(\d+)/actions/([\w_-]+)', views.group_plugin_action, name='sentry-group-plugin-action'),
  33 
  34     url(r'^$', views.index, name='sentry'),
  35 )
  36
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/sentry/urls.py b/sentry/urls.py
  --- a/sentry/urls.py
  +++ b/sentry/urls.py
  @@ -1,4 +1,5 @@
   import os
  +import re
   
   from django.conf.urls.defaults import *
   
  @@ -14,8 +15,8 @@
   
       # Feeds
   
  -    url(r'^feeds/%s/messages.xml$' % KEY, MessageFeed(), name='sentry-feed-messages'),
  -    url(r'^feeds/%s/summaries.xml$' % KEY, SummaryFeed(), name='sentry-feed-summaries'),
  +    url(r'^feeds/%s/messages.xml$' % re.escape(KEY), MessageFeed(), name='sentry-feed-messages'),
  +    url(r'^feeds/%s/summaries.xml$' % re.escape(KEY), SummaryFeed(), name='sentry-feed-summaries'),
   
       # JS and API
  
verification_info: {"golden_diff": "diff --git a/sentry/urls.py b/sentry/urls.py\n--- a/sentry/urls.py\n+++ b/sentry/urls.py\n@@ -1,4 +1,5 @@\n import os\n+import re\n \n from django.conf.urls.defaults import *\n \n@@ -14,8 +15,8 @@\n \n     # Feeds\n \n-    url(r'^feeds/%s/messages.xml$' % KEY, MessageFeed(), name='sentry-feed-messages'),\n-    url(r'^feeds/%s/summaries.xml$' % KEY, SummaryFeed(), name='sentry-feed-summaries'),\n+    url(r'^feeds/%s/messages.xml$' % re.escape(KEY), MessageFeed(), name='sentry-feed-messages'),\n+    url(r'^feeds/%s/summaries.xml$' % re.escape(KEY), SummaryFeed(), name='sentry-feed-summaries'),\n \n     # JS and API\n", "issue": "Limitations on SENTRY_KEY not documented\nI assumed that SENTRY_KEY was just any random string that should be unique to a deployment and kept secret (ie, serving a similar purpose to django's SECRET_KEY) so I generated a random string to use there. \n\nIt turns out that it's used in a URL for the feeds:\n\n```\nurl(r'^feeds/%s/messages.xml$' % KEY, MessageFeed(), name='sentry-feed-messages'),\n```\n\n(in sentry.urls)\n\nMine happened to have an '[' in it which caused a very confusing error about an unterminated regex. \n\nIt should be documented that SENTRY_KEY will make it into a URL (and further that django will try to then parse it as a regexp when trying to do reverse lookups) and thus can't have most punctuation. \n\n", "before_files": [{"content": "import os\n\nfrom django.conf.urls.defaults import *\n\nfrom sentry.conf import KEY\nfrom sentry import views\nfrom sentry.feeds import MessageFeed, SummaryFeed\n\nSENTRY_ROOT = os.path.dirname(__file__) \n\nurlpatterns = patterns('',\n    url(r'^_media/(?P<path>.*)$', 'django.views.static.serve',\n        {'document_root': os.path.join(SENTRY_ROOT, 'media')}, name='sentry-media'),\n\n    # Feeds\n\n    url(r'^feeds/%s/messages.xml$' % KEY, MessageFeed(), name='sentry-feed-messages'),\n    url(r'^feeds/%s/summaries.xml$' % KEY, SummaryFeed(), name='sentry-feed-summaries'),\n\n    # JS and API\n\n    url(r'^jsapi/$', views.ajax_handler, name='sentry-ajax'),\n    url(r'^store/$', views.store, name='sentry-store'),\n    \n    # Normal views\n\n    url(r'^login$', views.login, name='sentry-login'),\n    url(r'^logout$', views.logout, name='sentry-logout'),\n    url(r'^group/(\\d+)$', views.group, name='sentry-group'),\n    url(r'^group/(\\d+)/messages$', views.group_message_list, name='sentry-group-messages'),\n    url(r'^group/(\\d+)/messages/(\\d+)$', views.group_message_details, name='sentry-group-message'),\n    url(r'^group/(\\d+)/actions/([\\w_-]+)', views.group_plugin_action, name='sentry-group-plugin-action'),\n\n    url(r'^$', views.index, name='sentry'),\n)\n", "path": "sentry/urls.py"}], "after_files": [{"content": "import os\nimport re\n\nfrom django.conf.urls.defaults import *\n\nfrom sentry.conf import KEY\nfrom sentry import views\nfrom sentry.feeds import MessageFeed, SummaryFeed\n\nSENTRY_ROOT = os.path.dirname(__file__) \n\nurlpatterns = patterns('',\n    url(r'^_media/(?P<path>.*)$', 'django.views.static.serve',\n        {'document_root': os.path.join(SENTRY_ROOT, 'media')}, name='sentry-media'),\n\n    # Feeds\n\n    url(r'^feeds/%s/messages.xml$' % re.escape(KEY), MessageFeed(), name='sentry-feed-messages'),\n    url(r'^feeds/%s/summaries.xml$' % re.escape(KEY), SummaryFeed(), name='sentry-feed-summaries'),\n\n    # JS and API\n\n    url(r'^jsapi/$', views.ajax_handler, name='sentry-ajax'),\n    url(r'^store/$', views.store, name='sentry-store'),\n    \n    # Normal views\n\n    url(r'^login$', views.login, name='sentry-login'),\n    url(r'^logout$', views.logout, name='sentry-logout'),\n    url(r'^group/(\\d+)$', views.group, name='sentry-group'),\n    url(r'^group/(\\d+)/messages$', views.group_message_list, name='sentry-group-messages'),\n    url(r'^group/(\\d+)/messages/(\\d+)$', views.group_message_details, name='sentry-group-message'),\n    url(r'^group/(\\d+)/urls$', views.group_urls, name='sentry-group-urls'),\n    url(r'^group/(\\d+)/servers$', views.group_servers, name='sentry-group-servers'),\n    url(r'^group/(\\d+)/actions/([\\w_-]+)', views.group_plugin_action, name='sentry-group-plugin-action'),\n\n    url(r'^$', views.index, name='sentry'),\n)\n", "path": "sentry/urls.py"}]}