CSS not rendering in production using sekizai and cms_plugins

857 views
Skip to first unread message

Renier Engelbrecht

unread,
Jan 10, 2012, 2:33:22 AM1/10/12
to django-cms
Hi there,

I am beyond looking at the web and coding using django and django-cms.

My final html and css does not render correctly. It does not render
css at all for the given template. Yet, the admin works perfectly and
I can even run javascript in my templates that I render. I have
included the code. Please take a look at it, I have tried everything.

The base template: base.html

{% load cms_tags menu_tags sekizai_tags %}
<html>
<head>
<title>{% page_attribute page_title %}</title>
<meta name="description" content="{% page_attribute
meta_description %}"/>
<meta name="keywords" content="{% page_attribute meta_keywords %}"/
>
{% render_block "css" %}
</head>
<body>
{% addtoblock "css" %}
<link href="{{STATIC_URL}}cms/css/style.css" rel="stylestheet"
type="text/css"/>
{%endaddtoblock%}
{% load menu_tags %}
<ul>
{% show_menu 0 100 100 100 %}
</ul>
{% show_breadcrumb %}
{% placeholder base_content %}
{% block base_content%}{% endblock %}
{% render_block "js" %}
<ul>
{% block breadcrumb %}
{% show_breadcrumb %}
{% endblock %}
<ul>
{% cms_toolbar %}
</body>
</html>

The static files I serve from another static location in my apache
server in /var/www/static which I copied from my project.


MY settings.py
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')

STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')

# URL that handles the media served from MEDIA_ROOT. Make sure to use
a
# trailing slash if there is a path component (optional in other
cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '/media/'

STATIC_URL = '/static/'

What am I doing wrong? My WSGI alias is /itcat and my document root
is /var/www.

If I did not give enough information please let me know.

Regards,
Renier

Adriano Ribeiro

unread,
Jan 10, 2012, 7:20:17 AM1/10/12
to djang...@googlegroups.com
Hi,

I have same problem, if i put css and images in media directory all works fine, but if i put on static nothing is rendered.

Luke Crooks

unread,
Jan 10, 2012, 7:54:40 AM1/10/12
to djang...@googlegroups.com

I can tell you straight away that you aren't serving you static and media folders correctly with apache.

I don't use apache heavily so can't give you much help I'm afraid. Its alot easier with nginx. But I'm sure if you look up the apache documentation further you will find your answer.

--
You received this message because you are subscribed to the Google Groups "django-cms" group.
To post to this group, send email to djang...@googlegroups.com.
To unsubscribe from this group, send email to django-cms+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-cms?hl=en.

Manolis Stamatogiannakis

unread,
Jan 10, 2012, 8:11:38 AM1/10/12
to djang...@googlegroups.com
Hello Renier,
By "not rendering" I assume that e.g. the <link ... type="text/css"/> doesn't appear on the HTML page produced. Right?

Are you sure you have included sekizai.context_processors.sekizai to your TEMPLATE_CONTEXT_PROCESSORS?

Cheers,
Manolis

2012/1/10 Renier Engelbrecht <reniereng...@gmail.com>

Renier Engelbrecht

unread,
Jan 12, 2012, 2:40:46 PM1/12/12
to django-cms
But is it showing the admin part which is in a directory the same as
the cms directory.


On Jan 10, 2:54 pm, Luke Crooks <pumalo...@gmail.com> wrote:
> I can tell you straight away that you aren't serving you static and media
> folders correctly with apache.
>
> I don't use apache heavily so can't give you much help I'm afraid. Its alot
> easier with nginx. But I'm sure if you look up the apache documentation
> further you will find your answer.
> On Jan 10, 2012 8:55 AM, "Renier Engelbrecht" <renierengelbrech...@gmail.com>

Renier Engelbrecht

unread,
Jan 11, 2012, 6:43:38 AM1/11/12
to django-cms
The link does appear, but the html does not render the css part. If I
look at the source code and click on the CSS link then it does take me
to the CSS file.
The sekizai_context_processors.sekiza is in the
Template_context_Processors.

I think it is the way the Sekizai renders the content. Can someone
please explain to me the process Sekizai uses to create the html file.
Maybe there is a problem there.

This is my apache config file:
Alias /robots.txt "/var/www/robots.txt"
Alias /favicon.ico "/var/www/favicon.ico"
Alias /images "/var/www/images"
Alias /static "/var/www/static"

I designed a template and CSS without the sekiza tags. That works
fine, but when I use sekizai it does not work.

On Jan 10, 3:11 pm, Manolis Stamatogiannakis <msta...@gmail.com>
wrote:
> Hello Renier,
> By "not rendering" I assume that e.g. the <link ... type="text/css"/>
> doesn't appear on the HTML page produced. Right?
>
> Are you sure you have included sekizai.context_processors.sekizai to your
> TEMPLATE_CONTEXT_PROCESSORS?
>
> Cheers,
> Manolis
>
> 2012/1/10 Renier Engelbrecht <renierengelbrech...@gmail.com>
> ...

Manolis Stamatogiannakis

unread,
Jan 14, 2012, 4:46:15 PM1/14/12
to djang...@googlegroups.com
Hi Renier,

Are you sure that you have a working basic setup? Have you seen the "It worked!" screen mentioned in the tutorial?
http://readthedocs.org/docs/django-cms/en/2.2/getting_started/tutorial.html

As a second step, have you confirmed (e.g. from the Net panel of Firebug) that you don't get any HTTP errors when your page loads?

Regards,
Manolis

2012/1/11 Renier Engelbrecht <reniereng...@gmail.com>

Luke Crooks

unread,
Jan 15, 2012, 2:04:16 AM1/15/12
to djang...@googlegroups.com

If you load firebug I gaurantee all the admin media and static URL dirs are not being served by Apache.

In your settings.py you have a media URL, static URL and admin/media URL setting. You need to make sure apache is serving these folder locations. And they have the correct data in

Adriano Ribeiro

unread,
Jan 18, 2012, 12:17:28 PM1/18/12
to djang...@googlegroups.com
Hi guys,

I made work this way.

1 - i create at same level of my-djangoproject  a static directory and set as static root.
2 - i create a app_static inside my django app
3 - i set STATICFILES_DIRS  with something like: os.path.join(PROJECT_HOME, 'myapp/myapp_static'),

After this all works fine.

thank you for help

Nam Nguyen

unread,
Apr 17, 2012, 11:57:04 AM4/17/12
to djang...@googlegroups.com
I have the same problem: but if I let the files in media folder, it works!
2012/1/11 Renier Engelbrecht <reniereng...@gmail.com>
To unsubscribe from this group, send email to django-cms+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages