gpt4 book ai didi

未找到 JavaScript 文件/ERR_ABORTED

转载 作者:行者123 更新时间:2023-12-03 02:49:26 27 4
gpt4 key购买 nike

我正在创建一个与 Trello API 交互的 javascript 文件,但是当我运行该文件时,Chrome 开发工具中显示的是这样的内容:

获取 http://localhost:8080/js/trello.js net::ERR_ABORTED

GET http://localhost:8080/js/trello.js 404(未找到)

trello.js 肯定在/js 中,我只尝试过/trello.js 但似乎没有任何效果。有人可以帮助新手吗?我正在使用带有 Python 和 webapp2 的 Google App Engine。

HTML

<html>
<head>
<title>Admin Page</title>
</head>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="https://api.trello.com/1/client.js?key={APIKey}"></script>
<script type="text/javascript" src="js/trello.js"></script>
<body>
{% if admin %}
<p>All Work Requests</p>
<a href="{{ logout_url }}">log out</a><br>
<a href="trello.js">Trello test</a>
{% for result in results %}
<table>
<tr>
<th><b>{{ result.email }}</th>
<th><b> {{ result.date }}</th>
<th><b> {{ result.title }}</th>
<th><b> {{ result.key.id() }}</th>
<th><a href="/delete/{{ result.key.id() }}">Delete</a></th>
<th><a href="/assign/{{ result.key.id() }}">Assign</a></th>
</tr>
</table>
{% endfor %}
<p>{{ result }}</p>
{% else %}
<p>Welcome please <a href="{{ login_url }}">login...</a>
<p>Not admin</p>
{% endif %}
</body>
</html>

trello.js

var authenticationSuccess = function() {
console.log('Successful authentication');
};

var authenticationFailure = function() {
console.log('Failed authentication');
};

window.Trello.authorize({
type: 'popup',
name: 'Getting Started Application',
scope: {
read: 'true',
write: 'true' },
expiration: 'never',
success: authenticationSuccess,
error: authenticationFailure
});

var myList = 'removed';

var creationSuccess = function (data) {
console.log('Card created successfully.');
console.log(JSON.stringify(data, null, 2));
};

var newCard = {
name: 'New Test Card',
desc: 'This is the description of our new card.',
// Place this card at the top of our list
idList: myList,
pos: 'top'
};

window.Trello.post('/cards/', newCard, creationSuccess);

//window.Trello.put('/cards/[ID]', {name: 'New Test Card'});

最佳答案

您需要 app.yaml 中的静态 URL 处理程序。尝试:

- url: /static
static_dir: foldername/static

foldername如果静态目录位于文件夹内,则需要,其中文件夹与 app.yaml 处于同一级别。如果staticapp.yaml 处于同一水平,那么就是

- url: /static
static_dir: static

然后,输入您的 /js dir 位于静态目录中,并将路径更改为:

<script type="text/javascript" src="static/js/trello.js"></script>

或者,保留已有的路径,并在 app.yaml 中创建一个处理程序直接进入它:

- url: /js
static_dir: somefolder/static/js
# or static_dir: static/js if inside static dir which is at same level as app.yaml
# or static_dir: js if js dir at same level as app.yaml

我更喜欢将所有静态文件放在 static 中目录。喜欢static/js , static/img , static/fonts等。顶级解决方案通过一个 static 处理所有问题。网址处理程序

关于未找到 JavaScript 文件/ERR_ABORTED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47956352/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com