A
A
asmut2017-02-02 16:59:15
Django
asmut, 2017-02-02 16:59:15

Multiple projects and one master page (django)?

Good evening.
Started to embody the idea but there is a problem.
Idea: one main page (main application) with links to applications. Each project is individual, but they will intersect with each other in the distant future (slowly I study the site manager).
Immediately question / answer: Question: Why is the main page of the application, and not a static page? Answer: Perhaps over time it will become much more informative than just a menu of projects. But if static is better, I will definitely read it and delve into your logic.
Question: Why make such a fuss and not make each project independent? Answer: It is very convenient for the end user, and it will also be convenient to administer. I have read but have not yet tried the site manager in practice, but as a practicing proger I understand all the inherent functionality, and this is just a wonderful thing.
Now the problem itself:
Scheme: 1. Central application with settings (project) 2. Main (application) 3. First site (application)
Central application (urls):

from django.conf.urls import url, include
from django.contrib import admin

urlpatterns = [

    url(r'^admin/',     admin.site.urls),
    url(r'',  include('glavnaja.urls')),

]

Main application (index page):
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>сайт </title>
    <link rel="stylesheet" type="text/css" href="/static/glavnaja/style/home_glavnaja.css">
</head>
   <body>
<div class="OsnovnoiBlok">

    <table>

        <tr>
            <td>
                <div class="BlokSsilka">

                    <a href="{% url 'voda_home' %}" class="button13"> Купить воду </a>

                </div>
            </td>
            <td> <div class="BlokSsilka"> </div> </td>
            <td> <div class="BlokSsilka"> </div> </td>
        </tr>

        <tr>
            <td> <div class="BlokSsilka"> </div> </td>
            <td> <div class="BlokSsilka"> </div> </td>
            <td> <div class="BlokSsilka"> </div> </td>
        </tr>

    </table>

</div>

</body>
</html>

urls.py
from django.http import HttpResponse
from django.template.loader import render_to_string


def home(request):
    return HttpResponse(render_to_string('glavnaja/home.html'))

views.py
from django.http import HttpResponse from django.template.loader import render_to_string

def home(request): return HttpResponse(render_to_string('glavnaja/home.html'))

Here in index.html I'm trying through
<a href="{% url 'voda_home' %}" class="button13"> Купить воду </a>
call the site. But he tells me that 0 is found.
To be more precise, he says the following:
Reverse for 'voda_home' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

Who can tell me how to make it work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
asmut, 2017-02-03
@asmut

I think about the django admin panel and templates from experience, do you describe everything?
I started to study this system recently, I liked the heredity of templates, about the admin panel it seems to be expanding.
Can you tell me what I will face if I go in this direction?
But still, I will have to master the url in the template one way or another, because it is an inseparable part, in another way, it’s like just handling static

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question