Home > OS >  I'm get a report of error ') expected' in django
I'm get a report of error ') expected' in django

Time:10-04

I have a django website, and in my html I get these in my visual studio editor, I don't know why. Basically everything works, but I have some problem with flex, sometimes it doesn't work, also I don't know if it is connected.

Any idea what is this?

enter image description here

This is home.html

<section class="welcome_area clearfix" id="home" style="background-image: url({% static 'img/bg-img/welcome-bg.png' %})">

Same in base.html

<div class="mosh-breadcumb-area" style="background-image: url({% static 'img/core-img/breadcumb.png' %})">

EDIT

After changing based on sunil ghimire answer.

enter image description here

CodePudding user response:

home.html

<section class="welcome_area clearfix" id="home" style="background-image: url('{% static "img/bg-img/welcome-bg.png" %}')";>

base.html

<div class="mosh-breadcumb-area" style="background-image: url('{% static "img/core-img/breadcumb.png" %}')";>

CodePudding user response:

The problem is with the double and single quotes Django is misinterpreting them(strings ends at wrong place), because you have to use 3 nested strings.

your 3 strings are : 1 : "background-image: url()".

2 : '{% static %}'.

3 : "/img/core-img/breadcrumb.png"

how django is interpreting them (starting and ending quotes) :

1 : "background-image: url('{% static ".

2 : img/core-img/breadcumb.png.

3 : " %}')";>.

What you can do :

use Absolute url instead of {% static %}

  • Related