forked from the-benchmarker/web-frameworks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.py
More file actions
56 lines (53 loc) · 1.64 KB
/
Copy pathdatabase.py
File metadata and controls
56 lines (53 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from masonite.environment import LoadEnvironment, env
from masoniteorm.connections import ConnectionResolver
# Loads in the environment variables when this page is imported.
LoadEnvironment()
"""
The connections here don't determine the database but determine the "connection".
They can be named whatever you want.
"""
DATABASES = {
"default": env("DB_CONNECTION", "sqlite"),
"sqlite": {
"driver": "sqlite",
"database": env("SQLITE_DB_DATABASE", "masonite.sqlite3"),
"prefix": "",
"log_queries": env("DB_LOG"),
},
"mysql": {
"driver": "mysql",
"host": env("DB_HOST"),
"user": env("DB_USERNAME"),
"password": env("DB_PASSWORD"),
"database": env("DB_DATABASE"),
"port": env("DB_PORT"),
"prefix": "",
"grammar": "mysql",
"options": {
"charset": "utf8mb4",
},
"log_queries": env("DB_LOG"),
},
"postgres": {
"driver": "postgres",
"host": env("DB_HOST"),
"user": env("DB_USERNAME"),
"password": env("DB_PASSWORD"),
"database": env("DB_DATABASE"),
"port": env("DB_PORT"),
"prefix": "",
"grammar": "postgres",
"log_queries": env("DB_LOG"),
},
"mssql": {
"driver": "mssql",
"host": env("MSSQL_DATABASE_HOST"),
"user": env("MSSQL_DATABASE_USER"),
"password": env("MSSQL_DATABASE_PASSWORD"),
"database": env("MSSQL_DATABASE_DATABASE"),
"port": env("MSSQL_DATABASE_PORT"),
"prefix": "",
"log_queries": env("DB_LOG"),
},
}
DB = ConnectionResolver().set_connection_details(DATABASES)