Uncategorized

Python Django Server – Production


When running my Django Server in Production mode, there is a problem with the render of one HTML.
I have a HTML template, i copy and modify the content of it (according to some enter values) NAME_TEMPLATE.html then render this in to a different NAME_MODIFY.HTML.
When i restart the server the 1st and 2nd render work then after it’s always render the 1st and 2nd render in a random order.
But if i check my NAME_MODIFY.HTML content, i can see the value display is not what it’s in it.
An image of the HTML content and what it display in chrome.
CONTENT OF HTML and RENDER
I try different explorer, CTRL+F5 but seems not worked.
But if set the Django Server in DEBUG mode, then the issue disappear, when i enter always different value, i can see my value changed.
Hope it’s enough clear.
Thanks in advance.
When it’s write XXXXX… i replace some text (same as AAAAA..,BBBB..,CCCC..,DDD..)

CTRL+F5, Different Explorer, DEBUG MODE

def createdfichetechnique(request):  
    if request.method != 'POST':  
        pass  
    # L'utilisateur clique sur CREATE  
    else:  
        # récupération du HTML du Produit sélectionnié  
        product = request.POST.get('Product','NoProductSelected')  
        # récupération du testeur sélectionné  
        testerid = request.POST.get('Tester','NoTesterSelected')  
        # récupération de la version de Programme  
        programloadid = request.POST.get('programload','NoProgramSelected')  
        # récupération du lot entré  
        lot = request.POST.get('lot','NoProductSelected')  
        # Fonction pour générer la Fiche Technique en HTML  
        Return = CreateTechnicalSheet(product,lot,testerid,programloadid)  
        # Variable Python/HTML  
        context = {'product': product, 'lot': lot, 'Path': Return}  
    # Direction la fiche Technique générer  
    return render(request, 'products/fichetechniquegenerated.html', context)  
{% extends 'base.html' %}
{% block content %}
{% load static %}
<link rel="stylesheet" href="{% static "fichetechniquegenerated.css" %}">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Libre+Barcode+39+Extended+Text&display=swap" rel="stylesheet">
<br>
<br>
<br>
<br>
<br>
<tbody>
    <h1>Fiche Technique g  n  rer pour le produit <span class="product">{{ product }}</span> et le lot <span class="lot"><input style="border: 0;text-align:center;font-weight: bold;font-si$
    <div class="yesPrint">
    <table class="fichetechniquetable" id="fichetechnique" border=0 cellpadding=0 cellspacing=0 width=614 style="border-collapse:collapse;table-layout:fixed;width:461pt">
        <tr class="rowcontent"><td class="bluecase" id="leftcolumn">N   lot (Scan)</td><td class="greencase" id="rightcolumn" name="LOTTochange">QS7896Q</td></tr>
        <tr class="rowcontent" style="border-bottom: 1pt solid black;"><td class="blankcase" id="leftcolumn">Lot CSP</td><td class="blankcase" id="rightcolumn" name="LOTTochange2">QS7896</$
        <tr class="emptyrow"><td class="blankcase"><br></td><td class="blankcase"></td></tr>
        <tr class="rowcontent"><td class="bluecase" id="leftcolumn">Nom du Produit</td><td class="greencase" id="rightcolumn">XXXXXXXXX</td></tr>
        <tr class="rowcontent" style="border-bottom: 1pt solid black;"><td class="blankcase" id="leftcolumn">Montage</td><td class="blankcase" id="rightcolumn">Prod</td></tr>
        <tr class="emptyrow"><td class="blankcase"><br></td><td class="blankcase"></td></tr>
        <tr class="rowcontent"><td class="bluecase" id="leftcolumn">Tester Qualifi  </td><td class="greencase" id="rightcolumn">XXXXXXX</td></tr>
        <tr class="rowcontent"><td class="graycase" id="leftcolumn">Board (Interface)</td><td class="graycase" id="rightcolumn">P106A / P106B</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Test Program</td><td class="blankcase" id="rightcolumn">XXXXXXX</td></tr>
        <tr class="rowcontent" style="border-bottom: 1pt solid black;"><td class="bluecase" id="leftcolumn">Program Load</td><td class="graycase" id="rightcolumn">XXXXXX</td></tr>
        <tr class="emptyrow"><td class="blankcase"><br></td><td class="blankcase"></td></tr>
        <tr class="rowcontent"><td class="graycase" id="leftcolumn">Probecard Name</td><td class="graycase" id="rightcolumn">XXXXXX</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Probecard Sites</td><td class="blankcase" id="rightcolumn">32</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Probecard Caracteristics</td><td class="blankcase" id="rightcolumn">(C) Custom</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Probecard Type</td><td class="blankcase" id="rightcolumn">Cobra Point</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Number of columns in array</td><td class="blankcase" id="rightcolumn">8</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Number of row in array</td><td class="blankcase" id="rightcolumn">4</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Primary die location</td><td class="blankcase" id="rightcolumn">Lower left</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Numbering direction</td><td class="blankcase" id="rightcolumn">Horizontal</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Numbering pattern</td><td class="blankcase" id="rightcolumn">Zig Zag</td></tr>
        <tr class="rowcontent" style="border-bottom: 1pt solid black;"><td class="blankcase" id="leftcolumn">Prober Program</td><td class="blankcase" id="rightcolumn">XXXXX</td></tr>
        <tr class="emptyrow"><td class="blankcase"><br></td><td class="blankcase"></td></tr>
        <tr class="rowcontent"><td class="graycase" id="leftcolumn">Resp Tech</td><td class="graycase" id="rightcolumn">XXXXXXXX</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Test time wafer Approx (min)</td><td class="blankcase" id="rightcolumn">25</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Test time by Touchdown (ms)</td><td class="blankcase" id="rightcolumn">1200</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Dies</td><td class="blankcase" id="rightcolumn">XXXXXXX</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Test Program Sequence</td><td class="blankcase" id="rightcolumn">0.03</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Temp (  )</td><td class="blankcase" id="rightcolumn">Ambient</td></tr>
        <tr class="rowcontent"><td class="blankcase" id="leftcolumn">Base line number</td><td class="blankcase" id="rightcolumn">2319</td></tr>
        <tr class="rowcontent"><td class="blankcase" colspan="2" style="border-top: 1pt solid black;">Prober Program:</td></tr>
        <tr class="qrcode"><td class="qrcodetd" colspan="2">*LF~NET~XXXXXXX*</td></tr>
        <tr class="rowcontent"><td class="blankcase" colspan="2" style="text-align: center;">XXXXXXXXXX</td></tr>
        <tr class="rowcontent"><td class="blankcase" colspan="2" style="border-top: 1pt solid black;">Test Program:</td></tr>
        <tr class="qrcode"><td class="qrcodetd" colspan="2">*LH~TEST~XXXXXXXX*</td></tr>
        <tr class="rowcontent"><td class="blankcase" colspan="2" style="text-align: center;">XXXXXXX</td></tr>
        <tr class="rowcontent"><td class="blankcase" colspan="2" style="border-top: 1pt solid black;">Lot CSP:</td></tr>
        <tr class="qrcode"><td class="qrcodetd" colspan="2" name="LOTTochange3">*LH~LOT~QS7896*</td></tr>
        <tr class="rowcontent"><td class="blankcase" colspan="2" name="LOTTochange4" style="text-align: center;">QS7896</td></tr>
        <tr class="rowcontent"><td class="redcase" colspan="2">XXXXXXX</td></tr>
        <tr class="rowcontent"><td class="bluecase" id="leftcolumn">Specifics Informations:     Probe Card Location:</td><td class="bluecase" id="rightcolumn">D21</td></tr>
        <tr class="rowcontent"><td class="greencase" id="leftcolumn" colspan="2" style="color:var(--color-murata-red);border-top: none;">AAAAAA</td></tr>
        <tr class="rowcontent"><td class="greencase" id="leftcolumn" colspan="2" style="color:var(--color-murata-red);border-top: none;">BBBBBBB</td></tr>
        <tr class="rowcontent"><td class="greencase" id="leftcolumn" colspan="2" style="color:var(--color-murata-red);border-top: none;">CCCCCCC</td></tr>
    </table>
    </div>
    <br><br>
    <input class="buttonsave" value="Print" onclick="printDiv('fichetechnique')">
    <br><br>
</tbody>

<script>
function UpdateLotName(input){
    var Name1 = document.getElementsByName("LOTTochange")
    var Name2 = document.getElementsByName("LOTTochange2")
    var Name3 = document.getElementsByName("LOTTochange3")
    var Name4 = document.getElementsByName("LOTTochange4")
    console.log(input)
    console.log(Name1)
    console.log(input.value)
    Name1[0].innerHTML = input.value
    console.log(Name1.innerHTML)
    Name2[0].innerHTML = input.value.slice(0,-1)
    console.log(Name2.innerHTML)
    Name3[0].innerHTML = "*LH~LOT~" + input.value.slice(0,-1) + "*"
    console.log(Name3.innerHTML)
    Name4[0].innerHTML = input.value.slice(0,-1)
    console.log(Name4.innerHTML)
}
function printDiv(divID) {
    //Get the HTML of div
    var divElements="{% load static %}<link rel="stylesheet" href="{% static "fichetechniquegenerated.css" %}"><html><head><title></title></head><body><table class="fichetechniquetable" id="fichetechnique"  border=0 cellpadding=0 cellspacing=0 width=614 style="border-collapse:collapse;table-layout:fixed;width:461pt">" + document.getElementById(divID).innerHTML + '</table></body><style>.fichetechniquetable {color:#000000;font-family:"Courier New", monospace;font-weight: bold;border: 3px solid black;border-radius: 10px;margin-left: auto;margin-right: auto;}.bluecase {background:#CCFFFF;border-top: 1pt solid black;border-left: 1pt solid black;}-webkit-print-color-adjust: exact;</style>';
    console.log(divElements)
    //Get the HTML of whole page
    var oldPage = document.body.innerHTML;
    //Reset the page's HTML with div's HTML only
    //document.body.innerHTML = '{% load static %}<link rel="stylesheet" href="{% static "fichetechniquegenerated.css" %}"><html><head><title></title></head><body><table class="fichetechniquetable" id="fichetechnique"  border=0 cellpadding=0 cellspacing=0 width=614 style="border-collapse:collapse;table-layout:fixed;width:461pt"><tr class="rowcontent"><td class="bluecase" id="leftcolumn">N° lot (Scan)</td><td class="greencase" id="rightcolumn">QS7896Q</td></tr><tr class="rowcontent" style="border-bottom: 1pt solid black;"><td class="blankcase" id="leftcolumn">Lot CSP</td><td class="blankcase" id="rightcolumn">QS7896</td></tr><tr class="emptyrow"><td class="blankcase"><br></td><td class="blankcase"></td></tr><tr class="rowcontent"><td class="bluecase" id="leftcolumn">Nom du Produit</td><td class="greencase" id="rightcolumn">XXXXXXX</td></tr><tr class="rowcontent" style="border-bottom: 1pt solid black;"><td class="blankcase" id="leftcolumn">Status</td><td class="blankcase" id="rightcolumn">Eng</td></tr><tr class="emptyrow"><td class="blankcase"><br></td><td class="blankcase"></td></tr><tr class="rowcontent"><td class="bluecase" id="leftcolumn">Tester Qualifié</td><td class="greencase" id="rightcolumn">XXXXXXX</td></tr><tr class="rowcontent"><td class="graycase" id="leftcolumn">Board (Interface)</td><td class="graycase" id="rightcolumn">P106A / P106B</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Test Program</td><td class="blankcase" id="rightcolumn">XXXXXXXX</td></tr><tr class="rowcontent" style="border-bottom: 1pt solid black;"><td class="bluecase" id="leftcolumn">Program Load</td><td class="graycase" id="rightcolumn">XXXXXXX</td></tr><tr class="emptyrow"><td class="blankcase"><br></td><td class="blankcase"></td></tr><tr class="rowcontent"><td class="graycase" id="leftcolumn">Probecard Name</td><td class="graycase" id="rightcolumn">XXXXXXX</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Probecard Sites</td><td class="blankcase" id="rightcolumn">32</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Probecard Caracteristics</td><td class="blankcase" id="rightcolumn">(C) Custom</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Probecard Type</td><td class="blankcase" id="rightcolumn">Cobra Point</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Number of columns in array</td><td class="blankcase" id="rightcolumn">8</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Number of row in array</td><td class="blankcase" id="rightcolumn">4</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Primary die location</td><td class="blankcase" id="rightcolumn">Lower left</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Numbering direction</td><td class="blankcase" id="rightcolumn">Horizontal</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Numbering pattern</td><td class="blankcase" id="rightcolumn">Zig Zag</td></tr><tr class="rowcontent" style="border-bottom: 1pt solid black;"><td class="blankcase" id="leftcolumn">Prober Program</td><td class="blankcase" id="rightcolumn">XXXXXXXXX</td></tr><tr class="emptyrow"><td class="blankcase"><br></td><td class="blankcase"></td></tr><tr class="rowcontent"><td class="graycase" id="leftcolumn">Resp Tech</td><td class="graycase" id="rightcolumn">XXXXXXXX</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Test time wafer (min)</td><td class="blankcase" id="rightcolumn">25</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Test time by Touchdown (ms)</td><td class="blankcase" id="rightcolumn">1200</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Dies</td><td class="blankcase" id="rightcolumn">8160</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Test Program Sequence</td><td class="blankcase" id="rightcolumn">0.03</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Temp (°)</td><td class="blankcase" id="rightcolumn">Ambient</td></tr><tr class="rowcontent"><td class="blankcase" id="leftcolumn">Base line number</td><td class="blankcase" id="rightcolumn">2319</td></tr><tr class="rowcontent"><td class="blankcase" colspan="2" style="border-top: 1pt solid black;">Prober Program:</td></tr><tr class="qrcode"><td class="qrcodetd" colspan="2">*LF~NET~XXXXXXX*</td></tr><tr class="rowcontent"><td class="blankcase" colspan="2" style="text-align:center;">XXXXXXXXX</td></tr><tr class="rowcontent"><td class="blankcase" colspan="2" style="border-top: 1pt solid black;">Test Program:</td></tr><tr class="qrcode"><td class="qrcodetd" colspan="2" style="text-align:center;">*LH~TEST~XXXXXXXX*</td></tr><tr class="rowcontent"><td class="blankcase" colspan="2" style="text-align:center;">XXXXXXX</td></tr><tr class="rowcontent"><td class="blankcase" colspan="2" style="border-top: 1pt solid black;">Lot CSP:</td></tr><tr class="qrcode"><td class="qrcodetd" colspan="2">*LH~LOT~QS7896Q*</td></tr><tr class="rowcontent"><td class="blankcase" colspan="2" style="text-align:center;">QS7896</td></tr><tr class="rowcontent"><td class="redcase" colspan="2">AAAAAAAA</td></tr><tr class="rowcontent"><td class="bluecase" id="leftcolumn">Specifics Informations:     Probe Card Location:</td><td class="bluecase" id="rightcolumn">D21</td></tr><tr class="rowcontent"><td class="greencase" id="leftcolumn" colspan="2" style="color:var(--color-murata-red);border-top: none;">BBBBBBBBB</td></tr><tr class="rowcontent"><td class="greencase" id="leftcolumn" colspan="2" style="color:var(--color-murata-red);border-top: none;">CCCCCCCC</td></tr><tr class="rowcontent"><td class="greencase" id="leftcolumn" colspan="2" style="color:var(--color-murata-red);border-top: none;">CCCCCCC</td></tr></table></body><style>.fichetechniquetable {color:#000000;font-family:"Courier New", monospace;font-weight: bold;border: 3px solid black;border-radius: 10px;margin-left: auto;margin-right: auto;}.bluecase {background:#CCFFFF;border-top: 1pt solid black;border-left: 1pt solid black;}-webkit-print-color-adjust: exact;</style>';
    document.body.innerHTML = divElements
    //window.print();
    //document.body.innerHTML = oldPage;
    //Print Page
    setTimeout(function () {
        print_page();
    }, 200);
    function print_page() {
        window.print();
    }
    //Restore orignal HTML
    setTimeout(function () {
        restore_page();
    }, 200);
    function restore_page() {
        document.body.innerHTML = oldPage;
    }
}
</script>
{% endblock %}



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *