我大部分时间都在这里,有没有人让它成功地工作?我只有数据库本地工作,在我git push heroku master之后,与数据库的连接失败。
答案 0 :(得分:6)
通过Heroku CLI或项目的“资源”选项卡添加“Heroku Postgres”。它还应该为您提供稍后需要的' VBScript: IP_FileWrite.vbs
' Written by: Kathleen Williams
' Date: 2/7/18
' Class: COMP230
' Professor: Professor James Lewis
' ===================================
' This initializes a 2-dimension array
' of IP Address. The first index +100
' is the room# and the second index+1
' is the computer# in the room.
dim ipAddress(5,3)
ipAddress(0,0)="192.168.10.11"
ipAddress(0,1)="192.168.10.12"
ipAddress(0,2)="192.168.10.13"
ipAddress(0,3)="192.168.10.14"
ipAddress(1,0)="192.168.10.19"
ipAddress(1,1)="192.168.10.20"
ipAddress(1,2)="192.168.10.21"
ipAddress(1,3)="192.168.10.22"
ipAddress(2,0)="192.168.10.27"
ipAddress(2,1)="192.168.10.28"
ipAddress(2,2)="192.168.10.29"
ipAddress(2,3)="192.168.10.30"
ipAddress(3,0)="192.168.10.35"
ipAddress(3,1)="192.168.10.36"
ipAddress(3,2)="192.168.10.37"
ipAddress(3,3)="192.168.10.38"
ipAddress(4,0)="192.168.10.43"
ipAddress(4,1)="192.168.10.44"
ipAddress(4,2)="192.168.10.45"
ipAddress(4,3)="192.168.10.46"
ipAddress(5,0)="192.168.10.51"
ipAddress(5,1)="192.168.10.52"
ipAddress(5,2)="192.168.10.53"
ipAddress(5,3)="192.168.10.54"
' Define constants, variables and set object properties
CONST ForReading = 1
CONST ForWriting = 2
CONST ForAppending = 8
Const ASCII = 0
'Defining the Variables
fileName = "C:\VBScripts\IP_Addresses.csv"
ipAddrStr = ""
' Create New Folder
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(fileName) Then
fso.DeleteFile(fileName)
End If
Set ipAddrFile = fso.CreateTextFile("fileName,ForWriting,ASCII")
' Read from array and write a line of text.
For room = 0 to 5
For computer = 0 to 3
ipAddrStr = CStr(room+100) & "," & CStr(computer+1) & "," & _
ipAddress(room,computer) & vbCrLf
ipAddrFile.Write(ipAddrStr)
Next
Next
ipAddrFile.close
' Set object properties and close file object.
Set ipAddrFile = fso.OpenTextFile(fileName,Read,ASCII)
WScript.Echo iPAddrFile.ReadAll
ipAddrFile.close
变量。
从Heroku添加pg模块。请参阅文档here。
DATABASE_URL
然后,在服务器上,使用我们刚刚获得的$ npm install --save --save-exact pg
。
DATABASE_URL
将const client = new Client({
connectionString: process.env.DATABASE_URL,
ssl: true,
});
client.connect();
放在“生产”下的"use_env_variable": "DATABASE_URL"
文件中。应该看起来像
config.json
在Heroku上运行迁移。如果你想使用sequelize-cli,可以选择:
"production": {
"use_env_variable": "DATABASE_URL"
...
}
它应该有用。