我用了创建了一个vue webpack项目vue-cli.
vue init webpack myproject
Run Code Online (Sandbox Code Playgroud)
然后在dev模式下运行项目:
npm run dev
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误:
无法加载资源:服务器响应状态为404(未找到)http:// localhost:8080/favicon.ico
所以在webpack里面,如何favicon.ico正确导入?
我正在尝试关于vuejs的演示.现在我希望html标题绑定一个vm字段.
以下是我试过的:
index.html
<!DOCTYPE html>
<html id="html">
<head>
<title>{{ hello }}</title>
<script src="lib/requirejs/require.min.js" data-main="app"></script>
</head>
<body>
{{ hello }}
<input v-model="hello" title="hello" />
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
app.js
define([
'jquery', 'vue'
], function ($, Vue) {
var vm = new Vue({
el: 'html',
data: {
hello: 'Hello world'
}
});
});
Run Code Online (Sandbox Code Playgroud)
但标题似乎没有限制,如何使它工作?
这是我想要实现的一个例子.期望的效果是,当且仅当定义了其相关设置时,特定特征才应生效.否则,应禁用该功能.
settings.py:
SOME_VARIABLE = 'some-string'
ANOTHER_VARIABLE = 'another-string'Run Code Online (Sandbox Code Playgroud)
random_code_file.py:
from django.conf import settings
if settings.is_defined('ANOTHER_VARIABLE'): # <- I need this.
do_something(settings.ANOTHER_VARIABLE)
else:
do_something_completely_different()
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我错过了我应该做的任何事情而不是settings.is_defined.
如果这是解决问题的错误方法,我也很乐意听到其他方法.所需效果是自动激活功能,仅在存在相关设置时才会生效.我宁愿避免一些特殊settings.ACTIVE_FEATURES设置或特殊值,如空白字符串或无,以评估功能是否生效.
我想做的最后一件事是使用try/except.我宁愿选择一个空值来表示该功能被排除在外. - 但是如果尝试/除了它确实是首选方法,如果提供详尽的来源或解释,我会将答案标记为正确.事实上,这是任何答案.
简而言之,我需要以正确的方式检查Django中是否定义了设置变量.
提前致谢!
为什么我PHP Fatal error: Call to undefined function imagettftext()在第29行收到错误?
<?php
ob_start();
session_start();
$strings = '123456789';
$i = 0;
$characters = 6;
$code = '';
while ($i < $characters)
{
$code .= substr($strings, mt_rand(0, strlen($strings)-1), 1);
$i++;
}
$_SESSION['captcha'] = $code;
//generate image
$im = imagecreatetruecolor(124, 40);
$foreground = imagecolorallocate($im, 0, 0, 0);
$shadow = imagecolorallocate($im, 173, 172, 168);
$background = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 0, 0, 200, 200, $background);
// use your own font!
$font = 'monofont.ttf';
//draw …Run Code Online (Sandbox Code Playgroud) Font Awesome有一个非常好的图标集合,可用于Web项目.我想使用其中一个图标作为光标(自定义光标).
根据我的理解,Custom Cursors需要一个图片网址,但我无法找到Font Awesome图标的图片网址.
我正在定义一个文件组件
我想在该组件上使用props选项.
但是我在哪里可以添加代码?
<template>
<div class="hello">
<h1>{{ msg }}</h1>
</div>
</template>
<script>
export default {
data () {
return {
// note: changing this line won't causes changes
// with hot-reload because the reloaded component
// preserves its current state and we are modifying
// its initial state.
msg: 'Hello World!'
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1 {
color: #42b983;
}
</style>
Run Code Online (Sandbox Code Playgroud) 我在亚马逊ec2上使用fedora实例安装了vsftpd,它是最新版本,但我收到错误:在CuteFTP中:
COMMAND:> PASV 227 Entering Passive Mode (192,168,10,46,14,20)
COMMAND:> LIST
ERROR:> Can’t connect to remote server. Socket error = #10065.
ERROR:> PASV failed, trying PORT.
Run Code Online (Sandbox Code Playgroud)
在Filezilla中:
Command: PASV Response: 227 Entering Passive Mode (192,168,10,46,14,20)
Command: LIST Error: Connection timed out
Error: Failed to retrieve directory listing.
Run Code Online (Sandbox Code Playgroud)
试图连接thro'Chell并显示目录列表.
我有控制器'reportCtrl'和HTML代表6个表数据,只有几行我一次显示.
app.js
var appReport = angular.module('myAppReport', []);
appReport.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/showreport', {templateUrl: 'app/reports/reportsView.html', controller: 'reportCtrl'});
$routeProvider.when('/showreport/:type', {templateUrl: 'app/reports/reportsView.html', controller: 'reportCtrl'});
Run Code Online (Sandbox Code Playgroud)
每个表都有一个单击按钮,应该在浏览器中打开带有扩展表的新选项卡:
scope.onClick = function(path){
var real_path = $location.path() + '/' + path + '/';
$location.path( real_path );
// $window.open($location.path()); // doesn't work
};
Run Code Online (Sandbox Code Playgroud)
例如,我有根视图URL:
http://dev.test.com/reports/date/#/showreport
Run Code Online (Sandbox Code Playgroud)
现在,按下按钮后我想创建:
http://dev.test.com/reports/date/#/showreport/table_name
Run Code Online (Sandbox Code Playgroud)
并在新标签中打开它.如你所见,我试过$window.open($location.path());但它不起作用,没有任何反应.
谢谢,
我正在尝试使用mpdf将html转换为pdf.问题是我无法将CSS应用于pdf文件..
这是我的PHP代码:
<?php
$html = $divPrint;
$mpdf=new mPDF();
$stylesheet = file_get_contents('pdf.css');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($html,2);
$mpdf->Output();
exit;
?>
Run Code Online (Sandbox Code Playgroud)
它正在做的是在我的这个php页面上通过ajax获取html.但它给出的输出并没有附带我为它编写的CSS.
请告诉我现在要做什么?
我现在正在ubuntu 12上部署一个带有nginx和gunicorn的django应用程序.
我配置nginx虚拟主机文件如下:
server {
listen 80;
server_name mydomain.com;
access_log /var/log/nginx/gunicorn.log;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /static/ {
root /var/www/django/ecerp/erp/static/;
}
}
Run Code Online (Sandbox Code Playgroud)
我可以很好地请求django,但是当请求一个静态文件时,它会响应404状态.
我确定静态文件的根路径是正确的.
有人可以帮忙吗?
html ×3
javascript ×3
vue.js ×3
django ×2
ecmascript-6 ×2
mvvm ×2
php ×2
ajax ×1
amazon-ec2 ×1
angularjs ×1
css ×1
ec2-ami ×1
favicon ×1
font-awesome ×1
freetype ×1
freetype2 ×1
frontend ×1
ftp ×1
gunicorn ×1
html5 ×1
html5-canvas ×1
mpdf ×1
nginx ×1
php-gd ×1
python ×1
ubuntu ×1
vsftpd ×1
webpack ×1