简体   繁体   English

heroku没有在Django应用程序中加载js文件

[英]heroku not loading js files in django app

I tried deploying my django app on heroku, it works fine when i do heroku open, but when i click on buttons or some glyphicons they don't seem to work.The js files and bootstrap cdn js files are not being loaded.The css files are working fine though I tried python manage.py collectstatic as well.It didn't throw any error. 我试着在heroku上部署django应用程序,当我打开heroku时工作​​正常,但是当我单击按钮或某些glyphicons时它们似乎不起作用.js文件和bootstrap cdn js文件未加载。尽管我也尝试了python manage.py collectstatic,但文件工作正常,它没有引发任何错误。

My settings.py : 我的settings.py:

import os
import dj_database_url

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

Requirements.txt: Requirements.txt:

Django==1.11.6
dj-database-url==0.4.2
django-taggit==0.22.1
gunicorn==19.7.1
Pillow==3.1.2
Markdown==2.6.9
psycopg2==2.7.1
whitenoise==3.3.1

How can i solve this problem.Thanks 我该如何解决这个问题。

我通过将HTML文件中包含的引导CDN链接中的http更改为https解决了此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM