We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Missing legacy redirection from pypi.python.org/pypi/
**Describe the bug**
Redirections from `https://pypi.python.org/pypi/` are not handled (only redirected to `https://pypi.org/pypi/` by varnish (fastly)).

As https://pypi.org/pypi/ does not exists, it creates some broken links.

**Expected behavior**
A 301 to `https://pypi.org/`, simply.

**To Reproduce**
```$ curl -sI https://pypi.python.org/pypi/
HTTP/2 301 
server: Varnish
retry-after: 0
location: https://pypi.org/pypi/
[...redacted for readability...]
```



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `warehouse/routes.py`
Content:
```
1 # Licensed under the Apache License, Version 2.0 (the "License");
2 # you may not use this file except in compliance with the License.
3 # You may obtain a copy of the License at
4 #
5 # http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS,
9 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 # See the License for the specific language governing permissions and
11 # limitations under the License.
12 
13 
14 def includeme(config):
15     # We need to get the value of the Warehouse and Forklift domains, we'll use
16     # these to segregate the Warehouse routes from the Forklift routes until
17     # Forklift is properly split out into it's own project.
18     warehouse = config.get_settings().get("warehouse.domain")
19     files_url = config.get_settings()["files.url"]
20 
21     # Simple Route for health checks.
22     config.add_route("health", "/_health/")
23 
24     # Internal route to make it easier to force a particular status for
25     # debugging HTTPException templates.
26     config.add_route("force-status", "/_force-status/{status:[45]\d\d}/")
27 
28     # Basic global routes
29     config.add_route("index", "/", domain=warehouse)
30     config.add_route("robots.txt", "/robots.txt", domain=warehouse)
31     config.add_route("opensearch.xml", "/opensearch.xml", domain=warehouse)
32     config.add_route("index.sitemap.xml", "/sitemap.xml", domain=warehouse)
33     config.add_route(
34         "bucket.sitemap.xml",
35         "/{bucket}.sitemap.xml",
36         domain=warehouse,
37     )
38 
39     # Some static, template driven pages
40     config.add_template_view("help", "/help/", "pages/help.html")
41     config.add_template_view("security", "/security/", "pages/security.html")
42     config.add_template_view(
43         "sponsors",
44         "/sponsors/",
45         # Use the full resource path here to make it able to be overridden by
46         # pypi-theme.
47         "warehouse:templates/pages/sponsors.html",
48     )
49 
50     # Our legal policies
51     config.add_policy("terms-of-use", "terms.md")
52 
53     # HTML Snippets for including into other pages.
54     config.add_route(
55         "includes.current-user-indicator",
56         "/_includes/current-user-indicator/",
57         domain=warehouse,
58     )
59     config.add_route(
60         "includes.flash-messages",
61         "/_includes/flash-messages/",
62         domain=warehouse,
63     )
64     config.add_route(
65         "includes.current-user-profile-callout",
66         "/_includes/current-user-profile-callout/{username}",
67         factory="warehouse.accounts.models:UserFactory",
68         traverse="/{username}",
69         domain=warehouse,
70     )
71     config.add_route(
72         "includes.edit-project-button",
73         "/_includes/edit-project-button/{project_name}",
74         factory="warehouse.packaging.models:ProjectFactory",
75         traverse="/{project_name}",
76         domain=warehouse,
77     )
78     config.add_route(
79         "includes.profile-actions",
80         "/_includes/profile-actions/{username}",
81         factory="warehouse.accounts.models:UserFactory",
82         traverse="/{username}",
83         domain=warehouse,
84     )
85 
86     # Classifier Routes
87     config.add_route("classifiers", "/classifiers/", domain=warehouse)
88 
89     # Search Routes
90     config.add_route("search", "/search/", domain=warehouse)
91 
92     # Accounts
93     config.add_route(
94         "accounts.profile",
95         "/user/{username}/",
96         factory="warehouse.accounts.models:UserFactory",
97         traverse="/{username}",
98         domain=warehouse,
99     )
100     config.add_route("accounts.login", "/account/login/", domain=warehouse)
101     config.add_route("accounts.logout", "/account/logout/", domain=warehouse)
102     config.add_route(
103         "accounts.register",
104         "/account/register/",
105         domain=warehouse,
106     )
107     config.add_route(
108         "accounts.request-password-reset",
109         "/account/request-password-reset/",
110         domain=warehouse,
111     )
112     config.add_route(
113         "accounts.reset-password",
114         "/account/reset-password/",
115         domain=warehouse,
116     )
117     config.add_route(
118         "accounts.verify-email",
119         "/account/verify-email/",
120         domain=warehouse,
121     )
122 
123     # Management (views for logged-in users)
124     config.add_route("manage.account", "/manage/account/", domain=warehouse)
125     config.add_route("manage.projects", "/manage/projects/", domain=warehouse)
126     config.add_route(
127         "manage.project.settings",
128         "/manage/project/{project_name}/settings/",
129         factory="warehouse.packaging.models:ProjectFactory",
130         traverse="/{project_name}",
131         domain=warehouse,
132     )
133     config.add_route(
134         "manage.project.delete_project",
135         "/manage/project/{project_name}/delete_project/",
136         factory="warehouse.packaging.models:ProjectFactory",
137         traverse="/{project_name}",
138         domain=warehouse,
139     )
140     config.add_route(
141         "manage.project.destroy_docs",
142         "/manage/project/{project_name}/delete_project_docs/",
143         factory="warehouse.packaging.models:ProjectFactory",
144         traverse="/{project_name}",
145         domain=warehouse,
146     )
147     config.add_route(
148         "manage.project.releases",
149         "/manage/project/{project_name}/releases/",
150         factory="warehouse.packaging.models:ProjectFactory",
151         traverse="/{project_name}",
152         domain=warehouse,
153     )
154     config.add_route(
155         "manage.project.release",
156         "/manage/project/{project_name}/release/{version}/",
157         factory="warehouse.packaging.models:ProjectFactory",
158         traverse="/{project_name}/{version}",
159         domain=warehouse,
160     )
161     config.add_route(
162         "manage.project.roles",
163         "/manage/project/{project_name}/collaboration/",
164         factory="warehouse.packaging.models:ProjectFactory",
165         traverse="/{project_name}",
166         domain=warehouse,
167     )
168     config.add_route(
169         "manage.project.change_role",
170         "/manage/project/{project_name}/collaboration/change/",
171         factory="warehouse.packaging.models:ProjectFactory",
172         traverse="/{project_name}",
173         domain=warehouse,
174     )
175     config.add_route(
176         "manage.project.delete_role",
177         "/manage/project/{project_name}/collaboration/delete/",
178         factory="warehouse.packaging.models:ProjectFactory",
179         traverse="/{project_name}",
180         domain=warehouse,
181     )
182     config.add_route(
183         "manage.project.documentation",
184         "/manage/project/{project_name}/documentation/",
185         factory="warehouse.packaging.models:ProjectFactory",
186         traverse="/{project_name}",
187         domain=warehouse,
188     )
189     config.add_route(
190         "manage.project.history",
191         "/manage/project/{project_name}/history/",
192         factory="warehouse.packaging.models:ProjectFactory",
193         traverse="/{project_name}",
194         domain=warehouse,
195     )
196 
197     # Packaging
198     config.add_redirect('/p/{name}/', '/project/{name}/', domain=warehouse)
199     config.add_route(
200         "packaging.project",
201         "/project/{name}/",
202         factory="warehouse.packaging.models:ProjectFactory",
203         traverse="/{name}",
204         domain=warehouse,
205     )
206     config.add_route(
207         "packaging.release",
208         "/project/{name}/{version}/",
209         factory="warehouse.packaging.models:ProjectFactory",
210         traverse="/{name}/{version}",
211         domain=warehouse,
212     )
213     config.add_route("packaging.file", files_url)
214 
215     # SES Webhooks
216     config.add_route("ses.hook", "/_/ses-hook/", domain=warehouse)
217 
218     # RSS
219     config.add_route("rss.updates", "/rss/updates.xml", domain=warehouse)
220     config.add_route("rss.packages", "/rss/packages.xml", domain=warehouse)
221 
222     # Legacy URLs
223     config.add_route("legacy.api.simple.index", "/simple/", domain=warehouse)
224     config.add_route(
225         "legacy.api.simple.detail",
226         "/simple/{name}/",
227         factory="warehouse.packaging.models:ProjectFactory",
228         traverse="/{name}/",
229         read_only=True,
230         domain=warehouse,
231     )
232     config.add_route(
233         "legacy.api.json.project",
234         "/pypi/{name}/json",
235         factory="warehouse.packaging.models:ProjectFactory",
236         traverse="/{name}",
237         read_only=True,
238         domain=warehouse,
239     )
240     config.add_route(
241         "legacy.api.json.release",
242         "/pypi/{name}/{version}/json",
243         factory="warehouse.packaging.models:ProjectFactory",
244         traverse="/{name}/{version}",
245         read_only=True,
246         domain=warehouse,
247     )
248 
249     # Legacy Action URLs
250     # TODO: We should probably add Warehouse routes for these that just error
251     #       and direct people to use upload.pypi.io
252     config.add_pypi_action_route(
253         "legacy.api.pypi.file_upload",
254         "file_upload",
255         domain=warehouse,
256     )
257     config.add_pypi_action_route(
258         "legacy.api.pypi.submit",
259         "submit",
260         domain=warehouse,
261     )
262     config.add_pypi_action_route(
263         "legacy.api.pypi.submit_pkg_info",
264         "submit_pkg_info",
265         domain=warehouse,
266     )
267     config.add_pypi_action_route(
268         "legacy.api.pypi.doc_upload",
269         "doc_upload",
270         domain=warehouse,
271     )
272     config.add_pypi_action_route(
273         "legacy.api.pypi.doap",
274         "doap",
275         domain=warehouse,
276     )
277     config.add_pypi_action_route(
278         "legacy.api.pypi.list_classifiers",
279         "list_classifiers",
280         domain=warehouse,
281     )
282     config.add_pypi_action_route(
283         'legacy.api.pypi.search',
284         'search',
285         domain=warehouse,
286     )
287     config.add_pypi_action_route(
288         'legacy.api.pypi.browse',
289         'browse',
290         domain=warehouse,
291     )
292     config.add_pypi_action_route(
293         'legacy.api.pypi.files',
294         'files',
295         domain=warehouse,
296     )
297     config.add_pypi_action_route(
298         'legacy.api.pypi.display',
299         'display',
300         domain=warehouse,
301     )
302 
303     # Legacy XMLRPC
304     config.add_xmlrpc_endpoint(
305         "pypi",
306         pattern="/pypi",
307         header="Content-Type:text/xml",
308         domain=warehouse,
309     )
310     config.add_xmlrpc_endpoint(
311         "pypi_slash",
312         pattern="/pypi/",
313         header="Content-Type:text/xml",
314         domain=warehouse,
315     )
316     config.add_xmlrpc_endpoint(
317         "RPC2",
318         pattern="/RPC2",
319         header="Content-Type:text/xml",
320         domain=warehouse,
321     )
322 
323     # Legacy Documentation
324     config.add_route("legacy.docs", config.registry.settings["docs.url"])
325 
326     # Legacy Redirects
327     config.add_redirect("/pypi/{name}/", "/project/{name}/", domain=warehouse)
328     config.add_redirect(
329         "/pypi/{name}/{version}/",
330         "/project/{name}/{version}/",
331         domain=warehouse,
332     )
333     config.add_redirect("/packages/{path:.*}", files_url, domain=warehouse)
334 
335     # Legacy Action Redirects
336     config.add_pypi_action_redirect(
337         "rss",
338         "/rss/updates.xml",
339         domain=warehouse,
340     )
341     config.add_pypi_action_redirect(
342         "packages_rss",
343         "/rss/packages.xml",
344         domain=warehouse,
345     )
346
```
--- 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/warehouse/routes.py b/warehouse/routes.py
--- a/warehouse/routes.py
+++ b/warehouse/routes.py
@@ -330,6 +330,7 @@
         "/project/{name}/{version}/",
         domain=warehouse,
     )
+    config.add_redirect("/pypi/", "/", domain=warehouse)
     config.add_redirect("/packages/{path:.*}", files_url, domain=warehouse)
 
     # Legacy Action Redirects

{"golden_diff": "diff --git a/warehouse/routes.py b/warehouse/routes.py\n--- a/warehouse/routes.py\n+++ b/warehouse/routes.py\n@@ -330,6 +330,7 @@\n         \"/project/{name}/{version}/\",\n         domain=warehouse,\n     )\n+    config.add_redirect(\"/pypi/\", \"/\", domain=warehouse)\n     config.add_redirect(\"/packages/{path:.*}\", files_url, domain=warehouse)\n \n     # Legacy Action Redirects\n", "issue": "Missing legacy redirection from pypi.python.org/pypi/\n**Describe the bug**\r\nRedirections from `https://pypi.python.org/pypi/` are not handled (only redirected to `https://pypi.org/pypi/` by varnish (fastly)).\r\n\r\nAs https://pypi.org/pypi/ does not exists, it creates some broken links.\r\n\r\n**Expected behavior**\r\nA 301 to `https://pypi.org/`, simply.\r\n\r\n**To Reproduce**\r\n```$ curl -sI https://pypi.python.org/pypi/\r\nHTTP/2 301 \r\nserver: Varnish\r\nretry-after: 0\r\nlocation: https://pypi.org/pypi/\r\n[...redacted for readability...]\r\n```\r\n\r\n\n", "before_files": [{"content": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\ndef includeme(config):\n    # We need to get the value of the Warehouse and Forklift domains, we'll use\n    # these to segregate the Warehouse routes from the Forklift routes until\n    # Forklift is properly split out into it's own project.\n    warehouse = config.get_settings().get(\"warehouse.domain\")\n    files_url = config.get_settings()[\"files.url\"]\n\n    # Simple Route for health checks.\n    config.add_route(\"health\", \"/_health/\")\n\n    # Internal route to make it easier to force a particular status for\n    # debugging HTTPException templates.\n    config.add_route(\"force-status\", \"/_force-status/{status:[45]\\d\\d}/\")\n\n    # Basic global routes\n    config.add_route(\"index\", \"/\", domain=warehouse)\n    config.add_route(\"robots.txt\", \"/robots.txt\", domain=warehouse)\n    config.add_route(\"opensearch.xml\", \"/opensearch.xml\", domain=warehouse)\n    config.add_route(\"index.sitemap.xml\", \"/sitemap.xml\", domain=warehouse)\n    config.add_route(\n        \"bucket.sitemap.xml\",\n        \"/{bucket}.sitemap.xml\",\n        domain=warehouse,\n    )\n\n    # Some static, template driven pages\n    config.add_template_view(\"help\", \"/help/\", \"pages/help.html\")\n    config.add_template_view(\"security\", \"/security/\", \"pages/security.html\")\n    config.add_template_view(\n        \"sponsors\",\n        \"/sponsors/\",\n        # Use the full resource path here to make it able to be overridden by\n        # pypi-theme.\n        \"warehouse:templates/pages/sponsors.html\",\n    )\n\n    # Our legal policies\n    config.add_policy(\"terms-of-use\", \"terms.md\")\n\n    # HTML Snippets for including into other pages.\n    config.add_route(\n        \"includes.current-user-indicator\",\n        \"/_includes/current-user-indicator/\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"includes.flash-messages\",\n        \"/_includes/flash-messages/\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"includes.current-user-profile-callout\",\n        \"/_includes/current-user-profile-callout/{username}\",\n        factory=\"warehouse.accounts.models:UserFactory\",\n        traverse=\"/{username}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"includes.edit-project-button\",\n        \"/_includes/edit-project-button/{project_name}\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"includes.profile-actions\",\n        \"/_includes/profile-actions/{username}\",\n        factory=\"warehouse.accounts.models:UserFactory\",\n        traverse=\"/{username}\",\n        domain=warehouse,\n    )\n\n    # Classifier Routes\n    config.add_route(\"classifiers\", \"/classifiers/\", domain=warehouse)\n\n    # Search Routes\n    config.add_route(\"search\", \"/search/\", domain=warehouse)\n\n    # Accounts\n    config.add_route(\n        \"accounts.profile\",\n        \"/user/{username}/\",\n        factory=\"warehouse.accounts.models:UserFactory\",\n        traverse=\"/{username}\",\n        domain=warehouse,\n    )\n    config.add_route(\"accounts.login\", \"/account/login/\", domain=warehouse)\n    config.add_route(\"accounts.logout\", \"/account/logout/\", domain=warehouse)\n    config.add_route(\n        \"accounts.register\",\n        \"/account/register/\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"accounts.request-password-reset\",\n        \"/account/request-password-reset/\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"accounts.reset-password\",\n        \"/account/reset-password/\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"accounts.verify-email\",\n        \"/account/verify-email/\",\n        domain=warehouse,\n    )\n\n    # Management (views for logged-in users)\n    config.add_route(\"manage.account\", \"/manage/account/\", domain=warehouse)\n    config.add_route(\"manage.projects\", \"/manage/projects/\", domain=warehouse)\n    config.add_route(\n        \"manage.project.settings\",\n        \"/manage/project/{project_name}/settings/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.delete_project\",\n        \"/manage/project/{project_name}/delete_project/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.destroy_docs\",\n        \"/manage/project/{project_name}/delete_project_docs/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.releases\",\n        \"/manage/project/{project_name}/releases/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.release\",\n        \"/manage/project/{project_name}/release/{version}/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}/{version}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.roles\",\n        \"/manage/project/{project_name}/collaboration/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.change_role\",\n        \"/manage/project/{project_name}/collaboration/change/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.delete_role\",\n        \"/manage/project/{project_name}/collaboration/delete/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.documentation\",\n        \"/manage/project/{project_name}/documentation/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.history\",\n        \"/manage/project/{project_name}/history/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n\n    # Packaging\n    config.add_redirect('/p/{name}/', '/project/{name}/', domain=warehouse)\n    config.add_route(\n        \"packaging.project\",\n        \"/project/{name}/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"packaging.release\",\n        \"/project/{name}/{version}/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{name}/{version}\",\n        domain=warehouse,\n    )\n    config.add_route(\"packaging.file\", files_url)\n\n    # SES Webhooks\n    config.add_route(\"ses.hook\", \"/_/ses-hook/\", domain=warehouse)\n\n    # RSS\n    config.add_route(\"rss.updates\", \"/rss/updates.xml\", domain=warehouse)\n    config.add_route(\"rss.packages\", \"/rss/packages.xml\", domain=warehouse)\n\n    # Legacy URLs\n    config.add_route(\"legacy.api.simple.index\", \"/simple/\", domain=warehouse)\n    config.add_route(\n        \"legacy.api.simple.detail\",\n        \"/simple/{name}/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{name}/\",\n        read_only=True,\n        domain=warehouse,\n    )\n    config.add_route(\n        \"legacy.api.json.project\",\n        \"/pypi/{name}/json\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{name}\",\n        read_only=True,\n        domain=warehouse,\n    )\n    config.add_route(\n        \"legacy.api.json.release\",\n        \"/pypi/{name}/{version}/json\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{name}/{version}\",\n        read_only=True,\n        domain=warehouse,\n    )\n\n    # Legacy Action URLs\n    # TODO: We should probably add Warehouse routes for these that just error\n    #       and direct people to use upload.pypi.io\n    config.add_pypi_action_route(\n        \"legacy.api.pypi.file_upload\",\n        \"file_upload\",\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        \"legacy.api.pypi.submit\",\n        \"submit\",\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        \"legacy.api.pypi.submit_pkg_info\",\n        \"submit_pkg_info\",\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        \"legacy.api.pypi.doc_upload\",\n        \"doc_upload\",\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        \"legacy.api.pypi.doap\",\n        \"doap\",\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        \"legacy.api.pypi.list_classifiers\",\n        \"list_classifiers\",\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        'legacy.api.pypi.search',\n        'search',\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        'legacy.api.pypi.browse',\n        'browse',\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        'legacy.api.pypi.files',\n        'files',\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        'legacy.api.pypi.display',\n        'display',\n        domain=warehouse,\n    )\n\n    # Legacy XMLRPC\n    config.add_xmlrpc_endpoint(\n        \"pypi\",\n        pattern=\"/pypi\",\n        header=\"Content-Type:text/xml\",\n        domain=warehouse,\n    )\n    config.add_xmlrpc_endpoint(\n        \"pypi_slash\",\n        pattern=\"/pypi/\",\n        header=\"Content-Type:text/xml\",\n        domain=warehouse,\n    )\n    config.add_xmlrpc_endpoint(\n        \"RPC2\",\n        pattern=\"/RPC2\",\n        header=\"Content-Type:text/xml\",\n        domain=warehouse,\n    )\n\n    # Legacy Documentation\n    config.add_route(\"legacy.docs\", config.registry.settings[\"docs.url\"])\n\n    # Legacy Redirects\n    config.add_redirect(\"/pypi/{name}/\", \"/project/{name}/\", domain=warehouse)\n    config.add_redirect(\n        \"/pypi/{name}/{version}/\",\n        \"/project/{name}/{version}/\",\n        domain=warehouse,\n    )\n    config.add_redirect(\"/packages/{path:.*}\", files_url, domain=warehouse)\n\n    # Legacy Action Redirects\n    config.add_pypi_action_redirect(\n        \"rss\",\n        \"/rss/updates.xml\",\n        domain=warehouse,\n    )\n    config.add_pypi_action_redirect(\n        \"packages_rss\",\n        \"/rss/packages.xml\",\n        domain=warehouse,\n    )\n", "path": "warehouse/routes.py"}], "after_files": [{"content": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\ndef includeme(config):\n    # We need to get the value of the Warehouse and Forklift domains, we'll use\n    # these to segregate the Warehouse routes from the Forklift routes until\n    # Forklift is properly split out into it's own project.\n    warehouse = config.get_settings().get(\"warehouse.domain\")\n    files_url = config.get_settings()[\"files.url\"]\n\n    # Simple Route for health checks.\n    config.add_route(\"health\", \"/_health/\")\n\n    # Internal route to make it easier to force a particular status for\n    # debugging HTTPException templates.\n    config.add_route(\"force-status\", \"/_force-status/{status:[45]\\d\\d}/\")\n\n    # Basic global routes\n    config.add_route(\"index\", \"/\", domain=warehouse)\n    config.add_route(\"robots.txt\", \"/robots.txt\", domain=warehouse)\n    config.add_route(\"opensearch.xml\", \"/opensearch.xml\", domain=warehouse)\n    config.add_route(\"index.sitemap.xml\", \"/sitemap.xml\", domain=warehouse)\n    config.add_route(\n        \"bucket.sitemap.xml\",\n        \"/{bucket}.sitemap.xml\",\n        domain=warehouse,\n    )\n\n    # Some static, template driven pages\n    config.add_template_view(\"help\", \"/help/\", \"pages/help.html\")\n    config.add_template_view(\"security\", \"/security/\", \"pages/security.html\")\n    config.add_template_view(\n        \"sponsors\",\n        \"/sponsors/\",\n        # Use the full resource path here to make it able to be overridden by\n        # pypi-theme.\n        \"warehouse:templates/pages/sponsors.html\",\n    )\n\n    # Our legal policies\n    config.add_policy(\"terms-of-use\", \"terms.md\")\n\n    # HTML Snippets for including into other pages.\n    config.add_route(\n        \"includes.current-user-indicator\",\n        \"/_includes/current-user-indicator/\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"includes.flash-messages\",\n        \"/_includes/flash-messages/\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"includes.current-user-profile-callout\",\n        \"/_includes/current-user-profile-callout/{username}\",\n        factory=\"warehouse.accounts.models:UserFactory\",\n        traverse=\"/{username}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"includes.edit-project-button\",\n        \"/_includes/edit-project-button/{project_name}\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"includes.profile-actions\",\n        \"/_includes/profile-actions/{username}\",\n        factory=\"warehouse.accounts.models:UserFactory\",\n        traverse=\"/{username}\",\n        domain=warehouse,\n    )\n\n    # Classifier Routes\n    config.add_route(\"classifiers\", \"/classifiers/\", domain=warehouse)\n\n    # Search Routes\n    config.add_route(\"search\", \"/search/\", domain=warehouse)\n\n    # Accounts\n    config.add_route(\n        \"accounts.profile\",\n        \"/user/{username}/\",\n        factory=\"warehouse.accounts.models:UserFactory\",\n        traverse=\"/{username}\",\n        domain=warehouse,\n    )\n    config.add_route(\"accounts.login\", \"/account/login/\", domain=warehouse)\n    config.add_route(\"accounts.logout\", \"/account/logout/\", domain=warehouse)\n    config.add_route(\n        \"accounts.register\",\n        \"/account/register/\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"accounts.request-password-reset\",\n        \"/account/request-password-reset/\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"accounts.reset-password\",\n        \"/account/reset-password/\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"accounts.verify-email\",\n        \"/account/verify-email/\",\n        domain=warehouse,\n    )\n\n    # Management (views for logged-in users)\n    config.add_route(\"manage.account\", \"/manage/account/\", domain=warehouse)\n    config.add_route(\"manage.projects\", \"/manage/projects/\", domain=warehouse)\n    config.add_route(\n        \"manage.project.settings\",\n        \"/manage/project/{project_name}/settings/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.delete_project\",\n        \"/manage/project/{project_name}/delete_project/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.destroy_docs\",\n        \"/manage/project/{project_name}/delete_project_docs/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.releases\",\n        \"/manage/project/{project_name}/releases/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.release\",\n        \"/manage/project/{project_name}/release/{version}/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}/{version}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.roles\",\n        \"/manage/project/{project_name}/collaboration/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.change_role\",\n        \"/manage/project/{project_name}/collaboration/change/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.delete_role\",\n        \"/manage/project/{project_name}/collaboration/delete/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.documentation\",\n        \"/manage/project/{project_name}/documentation/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"manage.project.history\",\n        \"/manage/project/{project_name}/history/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{project_name}\",\n        domain=warehouse,\n    )\n\n    # Packaging\n    config.add_redirect('/p/{name}/', '/project/{name}/', domain=warehouse)\n    config.add_route(\n        \"packaging.project\",\n        \"/project/{name}/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{name}\",\n        domain=warehouse,\n    )\n    config.add_route(\n        \"packaging.release\",\n        \"/project/{name}/{version}/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{name}/{version}\",\n        domain=warehouse,\n    )\n    config.add_route(\"packaging.file\", files_url)\n\n    # SES Webhooks\n    config.add_route(\"ses.hook\", \"/_/ses-hook/\", domain=warehouse)\n\n    # RSS\n    config.add_route(\"rss.updates\", \"/rss/updates.xml\", domain=warehouse)\n    config.add_route(\"rss.packages\", \"/rss/packages.xml\", domain=warehouse)\n\n    # Legacy URLs\n    config.add_route(\"legacy.api.simple.index\", \"/simple/\", domain=warehouse)\n    config.add_route(\n        \"legacy.api.simple.detail\",\n        \"/simple/{name}/\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{name}/\",\n        read_only=True,\n        domain=warehouse,\n    )\n    config.add_route(\n        \"legacy.api.json.project\",\n        \"/pypi/{name}/json\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{name}\",\n        read_only=True,\n        domain=warehouse,\n    )\n    config.add_route(\n        \"legacy.api.json.release\",\n        \"/pypi/{name}/{version}/json\",\n        factory=\"warehouse.packaging.models:ProjectFactory\",\n        traverse=\"/{name}/{version}\",\n        read_only=True,\n        domain=warehouse,\n    )\n\n    # Legacy Action URLs\n    # TODO: We should probably add Warehouse routes for these that just error\n    #       and direct people to use upload.pypi.io\n    config.add_pypi_action_route(\n        \"legacy.api.pypi.file_upload\",\n        \"file_upload\",\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        \"legacy.api.pypi.submit\",\n        \"submit\",\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        \"legacy.api.pypi.submit_pkg_info\",\n        \"submit_pkg_info\",\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        \"legacy.api.pypi.doc_upload\",\n        \"doc_upload\",\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        \"legacy.api.pypi.doap\",\n        \"doap\",\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        \"legacy.api.pypi.list_classifiers\",\n        \"list_classifiers\",\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        'legacy.api.pypi.search',\n        'search',\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        'legacy.api.pypi.browse',\n        'browse',\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        'legacy.api.pypi.files',\n        'files',\n        domain=warehouse,\n    )\n    config.add_pypi_action_route(\n        'legacy.api.pypi.display',\n        'display',\n        domain=warehouse,\n    )\n\n    # Legacy XMLRPC\n    config.add_xmlrpc_endpoint(\n        \"pypi\",\n        pattern=\"/pypi\",\n        header=\"Content-Type:text/xml\",\n        domain=warehouse,\n    )\n    config.add_xmlrpc_endpoint(\n        \"pypi_slash\",\n        pattern=\"/pypi/\",\n        header=\"Content-Type:text/xml\",\n        domain=warehouse,\n    )\n    config.add_xmlrpc_endpoint(\n        \"RPC2\",\n        pattern=\"/RPC2\",\n        header=\"Content-Type:text/xml\",\n        domain=warehouse,\n    )\n\n    # Legacy Documentation\n    config.add_route(\"legacy.docs\", config.registry.settings[\"docs.url\"])\n\n    # Legacy Redirects\n    config.add_redirect(\"/pypi/{name}/\", \"/project/{name}/\", domain=warehouse)\n    config.add_redirect(\n        \"/pypi/{name}/{version}/\",\n        \"/project/{name}/{version}/\",\n        domain=warehouse,\n    )\n    config.add_redirect(\"/pypi/\", \"/\", domain=warehouse)\n    config.add_redirect(\"/packages/{path:.*}\", files_url, domain=warehouse)\n\n    # Legacy Action Redirects\n    config.add_pypi_action_redirect(\n        \"rss\",\n        \"/rss/updates.xml\",\n        domain=warehouse,\n    )\n    config.add_pypi_action_redirect(\n        \"packages_rss\",\n        \"/rss/packages.xml\",\n        domain=warehouse,\n    )\n", "path": "warehouse/routes.py"}]}