如何从html访问Django项目的应用程序?

时间:2016-04-20 17:15:09

标签: html django

在点击导航栏的元素时,我想访问另一个名为aps的django项目的应用程序。例如,accueil和s' authentifier正常工作但未找到图表返回404。另一方面,当我运行127.0.0.1:8000/aps时,它可以工作。 base.html



.get_or_create()



 APS / views.py

{% load staticfiles %}


<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
                <title>Temperature sensor </title>
                <!-- Core CSS - Include with every page -->
                <link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
                </head>
                <body>
                    <nav class="navbar navbar-default">
                        <div class="container-fluid">
                            <div class="navbar-header">
                                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                                    <span class="sr-only">Toggle navigation</span>
                                    <span class="icon-bar"></span>
                                    <span class="icon-bar"></span>
                                    <span class="icon-bar"></span>
                                </button>
                                <a class="navbar-brand" href="/accueil">Accueil </a>
                                <a class="navbar-brand" href="/index">Graphe </a>
                                <a class="navbar-brand" href="/login">S'authentifier </a>
                                
                            </div>
                            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                                <ul class="nav navbar-nav navbar-right">
                                    <li class="dropdown">
                                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Account
                                            <span class="caret"></span>
                                        </a>
                                        <ul class="dropdown-menu" role="menu">
                                            <li>
                                                <a href="/mail">changer mail</a>
                                            </li>
                                            <li>
                                                <a href="#">changer temps</a>
                                            </li>
                                            <li class="divider"></li>
                                            <li>
                                                <a href="/logout">Logout</a>
                                            </li>
                                        </ul>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </nav>

                {% block content %}
                {% endblock %}


                    <!-- Core Scripts - Include with every page -->
                    <script src = "{% static 'js/jquery.min.js' %}"></script>
                    <script src = "{% static 'js/bootstrap.min.js' %}"></script>
        {% block javascript %}
        {% endblock %}


            </body>
        </html>

aps // urls.py

from django.shortcuts import render
from rasp import foo
import json 
def index(request):
  return render(request, 'index.html', {'t' : foo()})

0 个答案:

没有答案