connect

python3 sqlalchemy pymysql connect string

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: using python3, I can connect to mysql using pymysql. all works as expected. enclosed code works. import pymysql conn = pymysql.connect(host='127.0.0.1', unix_socket='/home/jhgong/mysql/tmp/mysql.sock', user='root', passwd='my_pass', db='my_db', port='3333') cur = conn.cursor() cur.execute('select user from auth_users') for i in cur: print(i) trying to get sqlalchemy to connect with pymysql, the default example strings don't seem to work. the above example does not work unless I declare both the port number and a unix_socket. below is what I

What's difference with express-session and cookie-session?

…衆ロ難τιáo~ 提交于 2019-12-03 00:53:25
问题 I am new with Express . As Express 4.x has removed bundled middlewares. Any middleware I want to use should be required. When I read the README with express-session and cookie-session on github, I feel it hard to understand the difference. So I try to write simple code to figure it out. I run twice for each middleware. var express = require('express') , cookieParser = require('cookie-parser') , session = require('cookie-session') , express_sess = require('express-session') , app = express();

Working with Django's post_save() signal

匿名 (未验证) 提交于 2019-12-03 00:53:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have two tables: class Advertisement(models.Model): created_at = models.DateTimeField(auto_now_add=True) author_email = models.EmailField() class Verification(models.Model): advertisement = models.ForeignKeyField(Advertisement) key = models.CharField(max_length=32) And I need to auto populate Verification table after adding new advertisement. def gen_key(sender, instance, created, **kwargs): if created: from hashlib import md5 vkey = md5("%s%s" % (instance.author_email, instance.created_at)) ver = Verification(advertisement=instance) ver

Codeigniter: Unable to connect to your database server using the provided settings

匿名 (未验证) 提交于 2019-12-03 00:53:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I use codeigniter as cms framework, if database hostname is localhost, it works correctly. $db['default']['hostname'] = 'localhost'; $db['default']['username'] = 'root'; $db['default']['password'] = 'test'; $db['default']['database'] = 'jinma'; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; Using above configuration works correctly, but if hostname is changed to: $db['default']['hostname'] = '192.168.1.222'; A Database Error Occurred: Unable to connect to your database server using

curl: (7) Failed to connect to localhost port 8090: Connection refused

匿名 (未验证) 提交于 2019-12-03 00:50:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Need help. Have been trying for a solution to this issue and could not see an answer or rather I have not come across any. I have a docker container with NGINX, acting as a reverse proxy. Docker for Windows version 1.12.5(9503). upstream mysite { server 127.0.0.1:8090; #server localhost:8090; (have also tried this option) } server { listen 0.0.0.0:80; server_name localhost; location / { proxy_pass http://mysite; } } In the above code localhost:8090 is a url of a website that is hosted on IIS on my host machine. When I access the url on NGINX

ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)

匿名 (未验证) 提交于 2019-12-03 00:50:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I use the following command: mysql -u root -h 127.0.0.1 -p and the error message is : ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) Who can help me to fix it? 回答1: If you are using ubuntu , you have to use the following steps to avoid this error: run the command vim /etc/mysql/my.cnf comment bind-address = 127.0.0.1 using the # symbol restart your mysql server once. Update In Step 1, if you cannot find bind-address in the my.cnf file, look for it in /etc/mysql/mysql.conf.d/mysqld.cnf file. 回答2: Try localhost instead

Mongodb Driver: missing delimiting slash between hosts and options

匿名 (未验证) 提交于 2019-12-03 00:48:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I copied codes from MONGODB NODE.JS DRIVER 2.2 and modified a little. // connect to mongodb var MongoClient = require('mongodb').MongoClient, f = require('util').format; var user = encodeURIComponent('admin'), password = encodeURIComponent('123456'), authMechanism = 'DEFAULT', authSource = 'admin'; // connection url var url = f('mongodb://%s:%s@localhost:27017?authMechanism=%s&authSource=%s', user, password, authMechanism, authSource); var db = null; MongoClient.connect(url, function(err, db) { //Here is line 20! if(err) { console.log(

Error connecting to Azure: Illegal character in password with mongoose 5.0.1 but works in 4.13.9

匿名 (未验证) 提交于 2019-12-03 00:48:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a node.js application that is deployed to azure using CosmosDB and the MongoDB API. My application uses mongoose which works seamlessly in 4.13.9. My application that works connects as follows: var configDB = require('./config/database'); var mongoose = require('mongoose'); mongoose.connect(configDB.url, { useMongoClient: true } ); mongoose.Promise = global.Promise; var db = mongoose.connection; db.on('error', console.error.bind(console, 'MongoDB connection error:')); the config/database file is defined as follows (changed username,

Yeoman 'grunt test' fails on clean project with 'port already in use'

匿名 (未验证) 提交于 2019-12-03 00:48:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: With: Mac OS 10.8.4 Node 0.10.12 npm 1.3.1 grunt-cli 0.1.9 yo 1.0.0-rc.1 bower 0.9.2 generator-angular@0.3.0 I encounter the following error with a clean yo angular project, followed by grunt server then grunt test : Running "connect:test" (connect) task Fatal error: Port 9000 is already in use by another process. I'm new to Yeoman and am stumped. I've deleted my original project and created a new one in a fresh folder just to make sure I wasn't overlooking any invisible configs. I restarted the machine to make sure I wasn't running any

OpenSSL connection error SSL23_GET_SERVER_HELLO, but browser and curl works

匿名 (未验证) 提交于 2019-12-03 00:48:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm dealing with an issue where python can't connect to a specific server over ssl due to openssl not being able to complete the handshake. Curl and my browser work. I've tried a couple of different openssl versions and solutions , but can't seem to connect. Here is what I've tried on both of the following platforms. The output is printed slightly different on OpenSSL 1.0.1e, but it's still the same errors. Mac OSX Yosemite - OpenSSL 0.9.8zg 14 July 2015 Debian GNU/Linux 7 (wheezy) - OpenSSL 1.0.1e 11 Feb 2013 Without specifying which