Templates rendering problem

44 views
Skip to first unread message

Boris Romero

unread,
Oct 9, 2019, 10:48:52 PM10/9/19
to Django users
Hi! 

I recently update Django from 1.11 to 2.2.6 and I have a serious problem with the templates rendering when i put on production my site (Nginx + uWSGI + Django). The problem is a lot of '/n' and strangers characters that appears when I render any page, that obviuosly suggest is a encoding problem, but I can't find the exact configuration problem. It just happen when the app is deployed, that is, when DEBUG = False.

Any help?

Thanks!

lemme smash

unread,
Oct 10, 2019, 2:38:48 PM10/10/19
to Django users
so, it's not reproducing when you run it locally?
also, can you provide an example of string where you have "strange" character? most probably you store it in database.

Boris Romero

unread,
Oct 10, 2019, 3:15:42 PM10/10/19
to Django users
Hi! Yes, it's reproducing when I run it locally, but with DEBUG=FALSE and with nginx and uwsgi. And no, it's not a database encoding problem, it just involves the templates, because the same database, with diferents instances of the app (with the upload and without it) not make any differences.

Thanks for the ideas!
Captura de Pantalla 2019-10-10 a la(s) 12.13.11.png

Boris Romero

unread,
Oct 15, 2019, 6:31:26 PM10/15/19
to Django users
Any help or ideas? Thanks!

lemme smash

unread,
Oct 16, 2019, 11:59:21 AM10/16/19
to Django users
it's really hard to help here without understanding whats going on there. when i ask for example I meant not only piece of page screenshot to see what you mean, but whole stack of how you pass data in a view and how you render it in a template

Boris Romero

unread,
Oct 16, 2019, 3:39:53 PM10/16/19
to Django users
Thanks for the answer Lemme! As I said, my problems appear exactly when I update django from 1.11 to django 2.2.x. With this change a lot of libraries need to update, and now I was trying to remove some of them and proving if they are the reason of this strange behavior. Before update django, all works perfectly. 

Libraries who update with djnago 2.2.x are: channels, daphne, attrs, django-allauth, djnago-crispy-forms, djnago-extensions, django-taggit, psycopg2, djangorestframework, and subdomains (using a pull request for compatibility).

The problems happens with DEBUG=False, and using nginx and uwsgi, using the same configuration for django 1.11 and django 2.2.x

Greetings! 

lemme smash

unread,
Oct 16, 2019, 5:32:52 PM10/16/19
to Django users
okay, but it's even harder to guess what is a problem there without ability to see relevant code pieces. btw, you may want to check this https://www.geeksforgeeks.org/important-differences-between-python-2-x-and-python-3-x-with-examples/#Unicode as you most probably had to migrate python as well

Boris Romero

unread,
Oct 16, 2019, 7:35:36 PM10/16/19
to Django users
Thanks again for the answer. I believe the problem is related with unicode changes between python versions, but I think it's a problem from any library or dependency used at the app, whom is not working properly, because with the same python version the problem appears and dissapears using differents versions of the requirements (including Django version). The problem is I tried removing and downgrade libraries, but I can't reduce the problem to find where is exactly. I'm not sure if it's a library problem, or Django configuration, nginx or maybe uwsgi, and this is why I'm searching for advices here.

Thanks!

Boris Romero

unread,
Oct 16, 2019, 10:11:55 PM10/16/19
to Django users
Hi! I discover this problem start with Django 2.1, Django 2.0.13 still working good. I'm reading the changes on Django 2.1 whom can cause this problem. Thanks for the ideas!
Reply all
Reply to author
Forward
0 new messages