Re: Django + FAPWS doesnt show the templates/view correct

44 views
Skip to first unread message

Paul Backhouse

unread,
Aug 17, 2012, 6:57:03 AM8/17/12
to django...@googlegroups.com
Are you sure it's a views/templates issue? You're getting content that
looks correct in structure so I'd say the views + templates are fine.
Looks like a CSS issue to me.

If you're using firefox then install firebug and check the NET tab for
404s to your CSS files.

Paul

On Fri, 2012-08-17 at 02:43 -0700, keeran wrote:
> On the Django development server, django app works fine. But once I
> setup the production test run, I get only the text contents, where
> template views are not shown as intended. What am I going wrong?
>
> I have django 1.5 latest.
>
> Nginx - 0.8.54
>
> uWSGI - 1.2.5




keeran

unread,
Aug 17, 2012, 2:40:20 PM8/17/12
to django...@googlegroups.com
Yes, looks like something went wrong due to static file access; I find http/1.1 404 not found error under web console of firefox
Status Code:
    HTTP/1.1 404 NOT FOUND
 
 
still not yet resolved.

Melvyn Sopacua

unread,
Aug 18, 2012, 10:10:02 AM8/18/12
to django...@googlegroups.com
On 17-8-2012 11:43, keeran wrote:
>
>
> On the Django development server, django app works fine. But once I setup
> the production test run, I get only the text contents, where template views
> are not shown as intended. What am I going wrong?
>
> I have django 1.5 latest.
>
> Nginx - 0.8.54
First of all:
mkdir <the directory you name as STATIC_DIR in IT_mgmt/settings.py>
cd /home/test/Desktop/IT_mgmt && python manage.py collectstatic

Then in nginx.conf:
location /static {
alias <that same STATIC_DIR>;
}

--
Melvyn Sopacua

Amyth Arora

unread,
Aug 18, 2012, 2:33:24 PM8/18/12
to django...@googlegroups.com
Your Static Dir is not defined in the Server (Nginx) configuration. So
as Melvin said you'll need to create an alias for your static dir in
your server configuration file.
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>



--
Thanks & Regards
----------------------------

Amyth [Admin - Techstricks]
Email - aroras....@gmail.com, ad...@techstricks.com
Twitter - @a_myth_________
http://techstricks.com/

keeran

unread,
Aug 23, 2012, 1:08:26 AM8/23/12
to django...@googlegroups.com
I did following changes now., I still see the same observation - I suspect the img folder contents are not taken by webserver for some reason related to template tags not properly linked. any suggestion welcome.... (otherwise I think i need to go with apache + wsgi)
===========================
Added below settings under default (under /etc/nginx/conf.d & also under sites-enabled dir of nginx
----------------------------------------
listen <same port as wsgi>
servername localhost
location /static {
alias /home/keeran/Desktop/IT_mgmt/static/;
index index.html index.htm;
autoindex off;
=========================
Also, updated the
[uwsgi]
# set the http port
http = :8080
python_path = /home/keeran/Desktop/IT_mgmt/IT_mgmt/settings.py
# change to django project directory
chdir = /home/keeran/Desktop/IT_mgmt
# load django
module = IT_mgmt.wsgi
uwsgi --ini test.ini --enable-threads

On Friday, August 17, 2012 3:13:00 PM UTC+5:30, keeran wrote:

On the Django development server, django app works fine. But once I setup the production test run, I get only the text contents, where template views are not shown as intended. What am I going wrong?

I have django 1.5 latest.

 Nginx - 0.8.54

uWSGI - 1.2.5

Also tried FAPWS3.0 similar result;
 
cmd for uWSGI:
=============
sudo uwsgi --ini test.ini
 
 

test.ini content:
===============

[uwsgi]
# set the http port
http = :8080
python_path = /home/test/Desktop/IT_mgmt/IT_mgmt/settings.py/
# change to django project directory
chdir = /home/test/Desktop/IT_mgmt
# load django
module = IT_mgmt.wsgi

 

keeran

unread,
Sep 4, 2012, 11:48:18 PM9/4/12
to django...@googlegroups.com
 
 
Finally, I understood the solution is
 
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns()
Thanks,
keeran
Reply all
Reply to author
Forward
0 new messages