0

I have a Django project which has been set us using django-pipeline and django-compress. The code on github is pretty standard ex:

{% extends "base.html" %}
{% load static from staticfiles %}

{% block extra_head %}
<meta name="description" content="Company Desc">
<meta name="keywords" content="kw1, kw2, kw3, kw4">
<meta property='og:title' content='Company title'/>
<meta property='og:image' content="{% static 'images/image.png' %}"/>
<meta property='og:description' content='our motto'/>
<meta property='og:url' content='https://www.company.com' />
{% endblock extra_head %}

But when I clone the code from github and open it in sublime or pycharm style is injected into my html head for some reason and I cant figure out why. We are using Django 1.4, django-pipeline, django-compressor.

{% extends "base.html" %}
{% load static from staticfiles %}

{% block extra_head %}
<meta name="description" content="Company Desc">
<meta name="keywords" content="kw1, kw2, kw3, kw4">
<meta property='og:title' content='Company title'/>
<meta property='og:image' content="{% static 'images/image.png' %}"/>
<meta property='og:description' content='our motto'/>
<meta property='og:url' content='https://www.company.com' />
<style>
 //30 lines of compressed css.
</style>
{% endblock extra_head %}

Anyone know the cause of css being injected into the .html text file?

salty_coffee
  • 631
  • 1
  • 10
  • 22
  • This sounds like a problem with your text editor/IDE – Andrea Corbellini Aug 12 '18 at 20:34
  • @AndreaCorbellini, I was thinking the same thing at first (thought it was a PyCharm issue) but it does it in Atom, Brackets and Sublime as well... – salty_coffee Aug 12 '18 at 20:50
  • Maybe you're opening a different file than the one you're viewing on GitHub? A link would be helpful, though note that this has nothing to do with Django or programming in general – Andrea Corbellini Aug 12 '18 at 21:39
  • @AndreaCorbellini. improper loading of staticfiles from Django templates has nothing to do with Django programming? Its a private repo its the same file, I posted because I wasnt sure if it was a django-pipeline or django-compressed issue because I havent used them in the past – salty_coffee Aug 12 '18 at 21:56
  • As I understand it, the problem is that a template file viewed on GitHub looks different from the same file viewed from a text editor. In this scenario, Django gets never executed – Andrea Corbellini Aug 13 '18 at 11:11

0 Answers0