2016-05-02 97 views
0

我正在嘗試爲雅虎財務創建數據可視化,我已經在本地使用Django 1.9.2成功完成了這項工作。它刮擦雅虎財務,然後使用D3創建氣泡圖與工具提示。 但是,氣泡不顯示: https://pure-woodland-72284.herokuapp.com/ 這是Heroku日誌中顯示的內容。 Heroku Log Error Messages如何在Heroku中部署D3(Django App)?

DEBUG = True

ALLOWED_HOSTS = []

INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'rest_framework_swagger', 'mysite' ) TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates',

'DIRS': [ 
     # insert your TEMPLATE_DIRS here 
      os.path.join(os.path.dirname(__file__), 'templates'), 

    ], 
    'APP_DIRS': True, 
    'OPTIONS': { 
     'context_processors': [ 
      # Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this 
      # list if you haven't customized them: 
      'django.contrib.auth.context_processors.auth', 
      'django.template.context_processors.debug', 
      'django.template.context_processors.i18n', 
      'django.template.context_processors.media', 
      'django.template.context_processors.static', 
      'django.template.context_processors.tz', 
      'django.contrib.messages.context_processors.messages', 
     ], 
    }, 
}, 

]

REST_FRAMEWORK={ 'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly' ] }

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware', 
'django.middleware.common.CommonMiddleware', 
'django.middleware.csrf.CsrfViewMiddleware', 
'django.contrib.auth.middleware.AuthenticationMiddleware', 
'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 
'django.contrib.messages.middleware.MessageMiddleware', 
'django.middleware.clickjacking.XFrameOptionsMiddleware', 
'django.middleware.security.SecurityMiddleware', 

回答

0

您的控制檯有以下錯誤:

Mixed Content: The page at 'https://pure-woodland-72284.herokuapp.com/' was loaded over HTTPS, but requested an insecure stylesheet 'http://fonts.googleapis.com/css?family=Lobster+Two:400,700italic'. This request has been blocked; the content must be served over HTTPS. 

因此您收到'Uncaught ReferenceError: $ is not defined'錯誤,因爲你並沒有真正導入了庫

所以我猜你已經進口你的腳本(jQuery,d3.tip,cssfonts)從他們的cdn和導入時使用http。嘗試使用https導入它們,看看是否可以解決您的問題