GET http://127.0.0.1:8000/favicon.ico 400 (BAD REQUEST) - using angular.js and nvd3

744 views
Skip to first unread message

Heather Dawe

unread,
Oct 5, 2015, 4:19:50 AM10/5/15
to web2py-users
Hello I am getting a bad request when attempting to use angular.js with nvd3 for data visualisation.

My web2py controller passes a json to its view. This view code is shown below. It extends the layout.html which is the standard layout.html apart from I have added the javascript libraries angular.js, d3.min.js, nv.d3.js, angular-nvd.js and the css file nv.d3.min.css, all of which are required to use angular and nvd3 to generate data visualisations. I have tested the nvd3 and angular parts outside of web2py and the data visualisation works fine.

{{ extend 'layout.html' }}
<script type='text/javascript'>
    
   var funnel_app = angular.module("funnel_app", ['nvd3']);
   
   funnel_app.config(function($interpolateProvider) {
      $interpolateProvider.startSymbol('<?');
      $interpolateProvider.endSymbol('?>');
   });
   
      funnel_app.controller('mainCtrl', function($scope) {
            
                $scope.data = {{=XML(response.json(report_data))}};
    
                $scope.options = {
                   chart: {
                   type: 'multiChart',
                   height: 450,
                   margin : {
                   top: 30,
                   right: 60,
                   bottom: 50,
                   left: 70
                   },
                   color: d3.scale.category10().range(),
                   //useInteractiveGuideline: true,
                   transitionDuration: 500,
                   xAxis: {
                      tickFormat: function(d){
                         return d3.format(',f')(d);
                      }
                   },
                   yAxis1: {
                       tickFormat: function(d){
                         return d3.format(',.1f')(d);
                       }
                   },
                   yAxis2: {
                       tickFormat: function(d){
                          return d3.format(',.1f')(d);
                       }
                   }
              }
        
           }      
      });

</script>
<div data-ng-app="funnel_app">
   <div data-ng-controller="mainCtrl">
      <nvd3 options="options" data="data"></nvd3>
   </div>
</div>

The json looks like it is passing from the controller to the view fine - I have looked at the source generated by web2py and nothing looks strange. But I am getting this favicon.ico bad request error. I am not getting this error from any other view within the same web2py app and they all extend layout.html where favicon.ico is listed. It seems to be pointing at favicon at root rather than .../static/images/favicon.ico and I can't see why. Having spent a long time trying to work out what the issue is I thought I would post a question here - has anyone else had similar issue? 

Many thanks in advance!

Michele Comitini

unread,
Oct 5, 2015, 5:15:47 AM10/5/15
to web...@googlegroups.com
The favicon.ico is generated by the browser by looking at a link tag in html, it does not depend on your code posted here.
In the browser look in the full source of the html generated by web2py to find where favicon.ico is called.  Hint: look in views/layout.html


HTH

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Heather Dawe

unread,
Oct 5, 2015, 5:44:33 AM10/5/15
to web...@googlegroups.com
Hi Michele,

Many thanks for your reply. I am sorry if I did not make it clear in my first post that I have looked at layout.html in detail regarding this issue. While all of the other views in my app also extend layout.html, the only page (and therefore view) I am having this problem is the one above. To be clear I am not having the favicon issue with any other page even though they all use the same layout.html code!! This leads me to conclude (falsely or otherwise) that it is likely to be caused by this particular view and perhaps the use of angular.js and/or nvd3.js as this particular view is the only place I am currently using these additional javascript libraries. Either that or an issue related to passing the JSON from the web2py controller to the view (but having looked at the source html for this view generated by web2py it looks fine).

Many thanks again,
Heather 

You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/Q4SWpHY2YPY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Heather Dawe 
Director
Data Scientists Limited

@DataScientistHD
0797 2194283
Reply all
Reply to author
Forward
0 new messages