Template html works when double clicked but empty when accessed through server

33 views
Skip to first unread message

Adam Zedan

unread,
Aug 15, 2011, 8:50:56 PM8/15/11
to django...@googlegroups.com
Hi my html works properly when i double click it.

The code is

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>Demo</title>
        <link rel="stylesheet" href="file:///D:/Django-1.3/django/bin/SlickGrid/slick.grid.css" type="text/css" media="screen" charset="utf-8" />
        <link rel="stylesheet" href="file:///D:/Django-1.3/django/bin/SlickGrid/css/smoothness/jquery-ui-1.8.5.custom.css" type="text/css" media="screen" charset="utf-8" />
        <link rel="stylesheet" href="file:///D:/Django-1.3/django/bin/SlickGrid/examples/examples.css" type="text/css" media="screen" charset="utf-8" />
       
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script src="file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery-1.4.3.min.js"></script>
        <script src="file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery.event.drag-2.0.min.js"></script>

        <script src="file:///D:/Django-1.3/django/bin/SlickGrid/slick.core.js"></script>
        <script src="file:///D:/Django-1.3/django/bin/SlickGrid/slick.grid.js"></script>
      
       
       
       
        <script>
        var grid;
        var columns = [
            {id:"title", name:"Title", field:"title"},
            {id:"duration", name:"Duration", field:"duration"},
            {id:"%", name:"% Complete", field:"percentComplete"},
            {id:"start", name:"Start", field:"start"},
            {id:"finish", name:"Finish", field:"finish"},
            {id:"effort-driven", name:"Effort Driven", field:"effortDriven"}
        ];

        var options = {
            enableCellNavigation: true,
            enableColumnReorder: false
        };

        $(function() {
            var data = [];
            for (var i = 0; i < 500; i++) {
                data[i] = {
                    title: "Task " + i,
                    duration: "5 days",
                    percentComplete: Math.round(Math.random() * 100),
                    start: "01/01/2009",
                    finish: "01/05/2009",
                    effortDriven: (i % 5 == 0)
                };
            }

            grid = new Slick.Grid("#myGrid", data, columns, options);

            $("#myGrid").show();
        })
           
        </script>

      
    </head>

    <body>
         
         <table width="100%">
        <tr>
            <td valign="top" width="50%">
                <div id="myGrid" style="width:600px;height:500px;display:none;"></div>
            </td>
        </tr>
        </table>
           
    </body>
</html>

however when i run it the proper way i.e run the server "manage.py runserver" and enter the url i just get a blank screen ?? Does anyone know why this happens??

Konstantin Sushenko

unread,
Aug 15, 2011, 9:11:52 PM8/15/11
to Django users
what is the source code for the blank page?

Landy Chapman

unread,
Aug 15, 2011, 10:39:24 PM8/15/11
to Django users


On Aug 15, 9:11 pm, Konstantin Sushenko <ako...@gmail.com> wrote:
> what is the source code for the blank page?
>

beat me to the punch... can you paste
the url you're using when you get a blank page
urls.py
views.py

thanks
Message has been deleted

Adam Zedan

unread,
Aug 16, 2011, 12:04:29 AM8/16/11
to Django users

Adam Zedan

unread,
Aug 16, 2011, 12:07:12 AM8/16/11
to Django users
the url you're using when you get a blank page?
http://127.0.0.1:8000/db/

urls.py
url('^db/$', dbdemo),


views.py
def dbdemo(request):
list= Student_Info.objects.all()
#field=Student_Info._meta.get_all_field_names()
return render_to_response("db.html",{'content':list})

Adam Zedan

unread,
Aug 16, 2011, 12:09:33 AM8/16/11
to django...@googlegroups.com
Yes the title changes but my table does not appear. It only appear if i double click it ... :(


On Tue, Aug 16, 2011 at 7:46 AM, Landy Chapman <landy.c...@gmail.com> wrote:
When you get a blank page Does the title change?
Is debug mode on/off?
Is there an error message?


You could add this:
<body>
   <h1>My html IS being displayed</h1>

--
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.


Konstantin Sushenko

unread,
Aug 16, 2011, 12:25:15 AM8/16/11
to Django users
I can see the markup that you published in your original post. :) what
does the browser show when you look at the page source?

konstantin

On Aug 16, 12:04 am, Adam Zedan <zedan...@gmail.com> wrote:
> Its at the top most post..
> have a look athttp://groups.google.com/group/django-users/browse_thread/thread/8a50...
>

Adam Zedan

unread,
Aug 16, 2011, 12:31:12 AM8/16/11
to Django users
The browser shows
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Demo</title>
<link rel="stylesheet" href="file:///D:/Django-1.3/django/bin/
SlickGrid/slick.grid.css" type="text/css" media="screen"
charset="utf-8" />
<link rel="stylesheet" href="file:///D:/Django-1.3/django/bin/
SlickGrid/css/smoothness/jquery-ui-1.8.5.custom.css" type="text/css"
media="screen" charset="utf-8" />
<link rel="stylesheet" href="file:///D:/Django-1.3/django/bin/
SlickGrid/examples/examples.css" type="text/css" media="screen"
charset="utf-8" />

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.4.2/jquery.min.js"></script>

<script src="file:///D:/Django-1.3/django/bin/SlickGrid/lib/
jquery-1.4.3.min.js"></script>
<script src="file:///D:/Django-1.3/django/bin/SlickGrid/lib/
jquery.event.drag-2.0.min.js"></script>

<script src="file:///D:/Django-1.3/django/bin/SlickGrid/
slick.core.js"></script>
<script src="file:///D:/Django-1.3/django/bin/SlickGrid/
slick.grid.js"></script>


<script type="text/javascript">
var grid;
var columns = [
{id:"roll_no", name:"Roll No", field:"roll_no"},
{id:"cell_no", name:"Contact No", field:"cell_no"},
{id:"nationality", name:"Country", field:"nationality"},
{id:"e_mail", name:"E-Mail", field:"e_mail"},
];

var options = {
enableCellNavigation: true,
enableColumnReorder: false
};

$(function() {
var data = [];



grid = new Slick.Grid("#myGrid", data, columns, options);

$("#myGrid").show();
})

</script>
</head>
<body>
<table width="100%">
<tr>
<td valign="top" width="50%">
<div id="myGrid" style="width:600px;height:500px;display:none;"></
div>
</td>

</tr>

</table>
</body>
</html>


Note: I also saw the page source when i double click it directly (the
one working correctly) and compared both the result and apparently
there isnt any thing a bit different in them...

Adam Zedan

unread,
Aug 16, 2011, 1:53:22 AM8/16/11
to Django users
Any other suggestions what might be going wrong ??

Landy Chapman

unread,
Aug 16, 2011, 2:01:04 AM8/16/11
to Django users
From what I can tell it's not your fault. have a look at:
http://code.google.com/p/slickgrid/issues/detail?id=19

fix might be here
http://drupal.org/node/1094054#comment-4825024

Adam Zedan

unread,
Aug 16, 2011, 2:23:26 AM8/16/11
to Django users
okay going to error ansole of firefox here is what i got

Error: Slick is not defined
Source File: http://127.0.0.1:8000/db/
Line: 37

which is : grid = new Slick.Grid("#myGrid", data, columns, options);

and the warnings are
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/slick.grid.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/slick.core.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery.event.drag-2.0.min.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery-1.4.3.min.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/slick.grid.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/slick.core.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery.event.drag-2.0.min.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery-1.4.3.min.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/examples/examples.css.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/css/smoothness/jquery-ui-1.8.5.custom.css.

I think it cant link to those files when rendered or something... not
sure though ?? what do u guys think??

Jani Tiainen

unread,
Aug 16, 2011, 2:43:49 AM8/16/11
to django...@googlegroups.com
Hi,

You can't (and you shouldn't) use file urls in your original source but
should let the Django handle urls to them for you.

There is dedicated part about static file serving in documentation [1][2].

And if you really think that you're deploying your project to somewhere
you really expect everyone to have same directory structure on their
machines as you do? And even more, you think people really would
appreciate browser to load arbitrary files from a filesystem? :)


[1] https://docs.djangoproject.com/en/1.3/howto/static-files/
[2] https://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/

--

Jani Tiainen

Adam Zedan

unread,
Aug 16, 2011, 2:58:54 AM8/16/11
to django...@googlegroups.com
Thanks.. that what i just came across.
It seems firefox doesnt let u load static files
http://rubenlaguna.com/wp/2007/04/20/firefox-and-file-windows-unc-paths/


--
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+unsubscribe@googlegroups.com.

Adam Zedan

unread,
Aug 16, 2011, 3:04:28 AM8/16/11
to Django users
So what do u suggest ?? will that also solve the firefox security
issue.
currenty i am just using the following html code

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Demo</title>
</head>
<body>
<img src="file://E:\MyDocuments\My Pictures\Lisa_simpson.gif" /
>
</body>
</html>


On Aug 16, 11:58 am, Adam Zedan <zedan...@gmail.com> wrote:
> Thanks.. that what i just came across.
> It seems firefox doesnt let u load static fileshttp://rubenlaguna.com/wp/2007/04/20/firefox-and-file-windows-unc-paths/
>
> On Tue, Aug 16, 2011 at 11:43 AM, Jani Tiainen <rede...@gmail.com> wrote:
> > Hi,
>
> > You can't (and you shouldn't) use file urls in your original source but
> > should let the Django handle urls to them for you.
>
> > There is dedicated part about static file serving in documentation [1][2].
>
> > And if you really think that you're deploying your project to somewhere you
> > really expect everyone to have same directory structure on their machines as
> > you do? And even more, you think people really would appreciate browser to
> > load arbitrary files from a filesystem? :)
>
> > [1]https://docs.djangoproject.**com/en/1.3/howto/static-files/<https://docs.djangoproject.com/en/1.3/howto/static-files/>
> > [2]https://docs.djangoproject.**com/en/1.3/ref/contrib/**staticfiles/<https://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/>
>
> > --
>
> > Jani Tiainen
>
> > On 08/16/2011 09:23 AM, Adam Zedan wrote:
>
> >> okay going to error ansole of firefox here is what i got
>
> >> Error: Slick is not defined
> >> Source File:http://127.0.0.1:8000/db/
> >> Line: 37
>
> >> which is : grid = new Slick.Grid("#myGrid", data, columns, options);
>
> >> and the warnings are
> >> Security Error: Content athttp://127.0.0.1:8000/db/may not load or
> >> link to file:///D:/Django-1.3/django/**bin/SlickGrid/slick.grid.js.
> >> Security Error: Content athttp://127.0.0.1:8000/db/may not load or
> >> link to file:///D:/Django-1.3/django/**bin/SlickGrid/slick.core.js.
> >> Security Error: Content athttp://127.0.0.1:8000/db/may not load or
> >> link to file:///D:/Django-1.3/django/**bin/SlickGrid/lib/jquery.**
> >> event.drag-2.0.min.js.
> >> Security Error: Content athttp://127.0.0.1:8000/db/may not load or
> >> link to file:///D:/Django-1.3/django/**bin/SlickGrid/lib/jquery-1.4.**
> >> 3.min.js.
> >> Security Error: Content athttp://127.0.0.1:8000/db/may not load or
> >> link to file:///D:/Django-1.3/django/**bin/SlickGrid/slick.grid.js.
> >> Security Error: Content athttp://127.0.0.1:8000/db/may not load or
> >> link to file:///D:/Django-1.3/django/**bin/SlickGrid/slick.core.js.
> >> Security Error: Content athttp://127.0.0.1:8000/db/may not load or
> >> link to file:///D:/Django-1.3/django/**bin/SlickGrid/lib/jquery.**
> >> event.drag-2.0.min.js.
> >> Security Error: Content athttp://127.0.0.1:8000/db/may not load or
> >> link to file:///D:/Django-1.3/django/**bin/SlickGrid/lib/jquery-1.4.**
> >> 3.min.js.
> >> Security Error: Content athttp://127.0.0.1:8000/db/may not load or
> >> link to file:///D:/Django-1.3/django/**bin/SlickGrid/examples/**
> >> examples.css.
> >> Security Error: Content athttp://127.0.0.1:8000/db/may not load or
> >> link to file:///D:/Django-1.3/django/**bin/SlickGrid/css/smoothness/**
> >> jquery-ui-1.8.5.custom.css.
>
> >> I think it cant link to those files when rendered or something... not
> >> sure though ?? what do u guys think??
>
> >> On Aug 16, 11:01 am, Landy Chapman<landy.chapm...@gmail.**com<landy.chapm...@gmail.com>>
> >>  wrote:
>
> >>>  From what I can tell it's not your fault. have a look at:
> >>>  http://code.google.com/p/**slickgrid/issues/detail?id=19<http://code.google.com/p/slickgrid/issues/detail?id=19>
>
> >>> fix might be here
> >>>    http://drupal.org/node/**1094054#comment-4825024<http://drupal.org/node/1094054#comment-4825024>
>
> > --
> > 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+unsubscribe@**
> > googlegroups.com <django-users%2Bunsu...@googlegroups.com>.
> > For more options, visit this group athttp://groups.google.com/**
> > group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en>
> > .
>
>

Landy Chapman

unread,
Aug 16, 2011, 3:56:08 AM8/16/11
to Django users
Jani Tiainen is right
> > You can't (and you shouldn't) use file urls in your original source but
> > should let the Django handle urls to them for you.

..or hard-code relative links in your templates.
I was thinking about the file:/// un your urls; not the best idea but
they are absolute and will work on your local machine.

We know your template is rendering because
> Yes the title changes but my table does not appear. It only appear if i
> double click it ... :(

Were you using firefox before? If yes, that security error should
have nothing to do with it. My reasoning is
some, if not all of your file:/// urls are being used by FF -- since
the double-click event is being handled, and then the table appears.


Konstantin Sushenko

unread,
Aug 16, 2011, 7:43:25 AM8/16/11
to Django users
you do not see anything because the style on your root element is set
to "display:none" and the browser does not run scripts because they
are loaded from local URLs. as it says: it is a insecure to execute
scripts from local URLs. suppose you publish this page on your
production server, where would your visitors get there scripts? they
are not on their machines in "d:/django-1.3...". basically, it is
unclear to me what you are trying to achieve.

konstantin

Adam Zedan

unread,
Aug 17, 2011, 1:49:42 PM8/17/11
to django...@googlegroups.com
Are ou saying that the reason i get nothing when running through a url is that because of security reasons (i.e) loading data from local machine ?? if so could you tell me how i could solve that problem ??

--
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.


Reply all
Reply to author
Forward
0 new messages