| 149 | | 'settings': dict([(k, getattr(settings, k)) for k in dir(settings) if k.isupper()]), |
|---|
| | 145 | 'settings': get_safe_settings(), |
|---|
| | 146 | }) |
|---|
| | 147 | return HttpResponseNotFound(t.render(c), mimetype='text/html') |
|---|
| | 148 | |
|---|
| | 149 | def empty_urlconf(request): |
|---|
| | 150 | "Create an empty URLconf 404 error response." |
|---|
| | 151 | t = Template(EMPTY_URLCONF_TEMPLATE) |
|---|
| | 152 | c = Context({ |
|---|
| | 153 | 'project_name': settings.SETTINGS_MODULE.split('.')[0] |
|---|
| 542 | | {% if urlconf_is_empty %} |
|---|
| 543 | | <p>Your URLconf, <code>{{ settings.ROOT_URLCONF }}</code>, was empty.</p> |
|---|
| | 546 | {% if urlpatterns %} |
|---|
| | 547 | <p> |
|---|
| | 548 | Using the URLconf defined in <code>{{ settings.ROOT_URLCONF }}</code>, |
|---|
| | 549 | Django tried these URL patterns, in this order: |
|---|
| | 550 | </p> |
|---|
| | 551 | <ol> |
|---|
| | 552 | {% for pattern in urlpatterns %} |
|---|
| | 553 | <li>{{ pattern|escape }}</li> |
|---|
| | 554 | {% endfor %} |
|---|
| | 555 | </ol> |
|---|
| | 556 | <p>The current URL, <code>{{ request.path }}</code>, didn't match any of these.</p> |
|---|
| 545 | | {% if urlpatterns %} |
|---|
| 546 | | <p> |
|---|
| 547 | | Using the URLconf defined in <code>{{ settings.ROOT_URLCONF }}</code>, |
|---|
| 548 | | Django tried these URL patterns, in this order: |
|---|
| 549 | | </p> |
|---|
| 550 | | <ol> |
|---|
| 551 | | {% for pattern in urlpatterns %} |
|---|
| 552 | | <li>{{ pattern|escape }}</li> |
|---|
| 553 | | {% endfor %} |
|---|
| 554 | | </ol> |
|---|
| 555 | | <p>The current URL, <code>{{ request.path }}</code>, didn't match any of these.</p> |
|---|
| 556 | | {% else %} |
|---|
| 557 | | <p>{{ reason|escape }}</p> |
|---|
| 558 | | {% endif %} |
|---|
| | 558 | <p>{{ reason|escape }}</p> |
|---|
| | 572 | |
|---|
| | 573 | EMPTY_URLCONF_TEMPLATE = """ |
|---|
| | 574 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|---|
| | 575 | <html lang="en"><head> |
|---|
| | 576 | <meta http-equiv="content-type" content="text/html; charset=utf-8"> |
|---|
| | 577 | <meta name="robots" content="NONE,NOARCHIVE"><title>Welcome to Django</title> |
|---|
| | 578 | <style type="text/css"> |
|---|
| | 579 | html * { padding:0; margin:0; } |
|---|
| | 580 | body * { padding:10px 20px; } |
|---|
| | 581 | body * * { padding:0; } |
|---|
| | 582 | body { font:small sans-serif; } |
|---|
| | 583 | body>div { border-bottom:1px solid #ddd; } |
|---|
| | 584 | h1 { font-weight:normal; } |
|---|
| | 585 | h2 { margin-bottom:.8em; } |
|---|
| | 586 | h2 span { font-size:80%; color:#666; font-weight:normal; } |
|---|
| | 587 | h3 { margin:1em 0 .5em 0; } |
|---|
| | 588 | h4 { margin:0 0 .5em 0; font-weight: normal; } |
|---|
| | 589 | table { border:1px solid #ccc; border-collapse: collapse; width:100%; background:white; } |
|---|
| | 590 | tbody td, tbody th { vertical-align:top; padding:2px 3px; } |
|---|
| | 591 | thead th { padding:1px 6px 1px 3px; background:#fefefe; text-align:left; font-weight:normal; font-size:11px; border:1px solid #ddd; } |
|---|
| | 592 | tbody th { width:12em; text-align:right; color:#666; padding-right:.5em; } |
|---|
| | 593 | ul { margin-left: 2em; margin-top: 1em; } |
|---|
| | 594 | #summary { background: #e0ebff; } |
|---|
| | 595 | #summary h2 { font-weight: normal; color: #666; } |
|---|
| | 596 | #explanation { background:#eee; } |
|---|
| | 597 | #instructions { background:#f6f6f6; } |
|---|
| | 598 | #summary table { border:none; background:transparent; } |
|---|
| | 599 | </style> |
|---|
| | 600 | </head> |
|---|
| | 601 | |
|---|
| | 602 | <body> |
|---|
| | 603 | <div id="summary"> |
|---|
| | 604 | <h1>It worked!</h1> |
|---|
| | 605 | <h2>Congratulations on your first Django-powered page.</h2> |
|---|
| | 606 | </div> |
|---|
| | 607 | |
|---|
| | 608 | <div id="instructions"> |
|---|
| | 609 | <p>Of course, you haven't actually done any work yet. Here's what to do next:</p> |
|---|
| | 610 | <ul> |
|---|
| | 611 | <li>Edit the <code>DATABASE_*</code> settings in <code>{{ project_name }}/settings.py</code>.</li> |
|---|
| | 612 | <li>Start your first app by running <code>{{ project_name }}/manage.py startapp [appname]</code>.</li> |
|---|
| | 613 | </ul> |
|---|
| | 614 | </div> |
|---|
| | 615 | |
|---|
| | 616 | <div id="explanation"> |
|---|
| | 617 | <p> |
|---|
| | 618 | You're seeing this message because you have <code>DEBUG = True</code> in your |
|---|
| | 619 | Django settings file and you haven't configured any URLs. Get to work! |
|---|
| | 620 | </p> |
|---|
| | 621 | </div> |
|---|
| | 622 | </body></html> |
|---|
| | 623 | """ |
|---|