我跟随swampdragon tutorial。 我完成了它,复制并粘贴了所有内容,但是当我在http://localhost:8000/时,我在javascript控制台中收到了此错误。
GET http://localhost:8000/swampdragon/js/dist/datamapper.js
GET http://localhost:8000/swampdragon/js/angular/services.js
GET http://localhost:8000/controllers.js
GET http://localhost:8000/app.js
angular.js:36Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.21/$injector/modulerr?p0=TodoApp&p1=Error%3…gleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.21%2Fangular.min.js%3A18%3A277)
以下是我的设置:
STATIC_URL = '/static/'
# SwampDragon settings
SWAMP_DRAGON_CONNECTION = ('swampdragon.connections.sockjs_connection.DjangoSubscriberConnection', '/data')
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
DRAGON_URL = 'http://localhost:9999/'
这里是我的index.html:
{% load static swampdragon_tags %}
html code
...
...
<!-- AngularJS -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js"></script>
{% swampdragon_settings %}
<script type="text/javascript" src="{% static 'swampdragon/js/dist/swampdragon.min.js' %}"></script>
<script type="text/javascript" src="{{ STATIC_URL }}swampdragon/js/dist/datamapper.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}swampdragon/js/angular/services.js"></script>
<!-- To-do app -->
<script type="text/javascript" src="{{ STATIC_URL }}app.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}controllers.js"></script>
答案 0 :(得分:0)
所以我在github上得到了答案,这是解决方案。这是STATIC_URL。
public class DateRatePair
{
public String Date { get; set; }
public String Rate { get; set; }
}