我正在尝试使用 Fullcalendar 来渲染从另一个使用 Flask 用 Python 编写的应用程序返回的事件。我已经成功查询应用程序并在我的测试设置(我的笔记本电脑本地)上将 JSON 返回到 Fullcalendar,效果很好。
当我尝试将相同的代码部署到服务器(带有 Apache 的 CentOS 7)时,Apache 记录以下错误:
AH00128: File does not exist: /etc/httpd/htdocs/data
calendar.html 模板的摘录如下:
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,listWeek'
},
defaultView: 'listWeek',
editable: false,
eventLimit: true, // allow "more" link when too many events
events: {
url: 'data',
error: function() {
$('#script-warning').show();
}
},
loading: function(bool) {
$('#loading').toggle(bool);
}
});
});
</script>
我发现 url: 'data'
行似乎正在控制路径,但我无法在那里设置任何有效的内容。我在代码中看不到可以设置路径的其他任何地方 - 显然 /etc/httpd/htdocs/data/
无效 - 如何配置路径以便呈现数据?
编辑:我相信这是一个 Apache 问题 - 我的 conf 文件如下:
<virtualhost *:443>
ServerName server.example.com
LogLevel info
SSLEngine On
SSLProtocol all -SSLv2 -SSLv3
WSGIDaemonProcess fs_calendar user=apache group=apache threads=5 home=/var/www/fs_calendar/
WSGIScriptAlias /fs_calendar /var/www/fs_calendar/calendar.wsgi
<directory /var/www/fs_calendar>
WSGIProcessGroup fs_api
WSGIApplicationGroup %{GLOBAL}
WSGIScriptReloading On
WSGIPassAuthorization On
Order deny,allow
Allow from all
</directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/server.example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/server.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/server.example.com/chain.pem
</virtualhost>
最佳答案
听起来您的网址指向的位置不匹配。
尝试放置
url: "https://myhost/data"
在您的代码中绝对确定它指向正确的位置。
关于javascript - Fullcalendar 无法定位/数据馈送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50336493/