在Heroku中托管项目时如何将外部文件路径添加到Django

时间:2019-05-03 16:50:35

标签: python django heroku nltk hosting

代码包含django项目中某些外部文件的某些路径。例如-stanfordpostager.jar的路径,java jdk的路径。 该项目已在本地主机中成功运行,但是将项目推送到Heroku时,推送被拒绝。它是FileNotFoundError。 代码:-

cred = credentials.Certificate("../locationnewstest/news/newsapp.json")
jar = '../locationnewstest/stanford-postagger-2018-10-16/stanford-postagger.jar'
model = '../locationnewstest/stanford-postagger-2018-10-16/models/english-left3words-distsim.tagger'
java_path = "C:/Program Files/Java/jdk1.8.0_101/bin/java.exe"

os.environ['JAVAHOME'] = java_path
nltk.internals.config_java('C:/Program Files/Java/jdk1.8.0_101/bin/java.exe')```

The output:-

remote:        FileNotFoundError: [Errno 2] No such file or directory: '../locationnewstest/news/newsapp.json'
remote:
remote:  !     Error while running '$ python manage.py collectstatic --noinput'.
remote:        See traceback above for details.

0 个答案:

没有答案