Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

407
Views
Jinja2 HTML templates use multiple nested quotation marks (" and ')

The question is simple, I am using jinja2 html templates and I am supposed to include {{ url_for('static', filename='img/background.png') }} inside of url(''), inside of style="".

The proble is that there is a quotation mark conflict, because there are two nested ' marks

<body id="body-pd" style="background: url('{{ url_for('static', filename='img/background.png') }}') no-repeat center center fixed; background-size: cover;">

Is there some sort of scape character to be used?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The answer to this problem is also very simple: there's no problem. The Jinja environment (server side) and browser/frontend environment have different lifecycle.

Jinja only sees this part:

{{ url_for('static', filename='img/background.png') }}

It produces a path, e.g. /static/img/background.png and replaces the whole {{ ... }} snippet with it. The frontend environment never sees Jinja-related parts. So there's no quotation mark conflict, because half of them will be eliminated by Jinja on the server side.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!