-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
180 lines (168 loc) · 6.73 KB
/
config.py
File metadata and controls
180 lines (168 loc) · 6.73 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#
#
# pow settings file
#
import simplejson as json
import redmonty.encoders
import os
import logging
import datetime
server_settings = {
"protocol" : "http://",
"host" : "0.0.0.0",
"port" : 8080,
"debug" : True,
"debug_print" : True,
#Logs a stack trace if the IOLoop is blocked for more than s seconds. so 0.050 means 50ms
"IOLoop.set_blocking_log_threshold" : 0,
"logging" : True,
"analytics_logging" : False,
"https" : False,
"template_path" : os.path.join(os.path.dirname(__file__), "views"),
"static_url_prefix" : "/static/",
"static_path" : os.path.join(os.path.dirname(__file__), "static"),
"login_url" : "/login",
"xsrf_cookies" : False,
#"log_function" : you can give your own log function here.
"cookie_secret" : "7045e3e3-22fe-4594-a8d0-1bafe088a33b"
}
templates = {
"template_path" : server_settings["template_path"],
"handler_path" : os.path.join(os.path.dirname(__file__), "handlers"),
"model_path" : os.path.join(os.path.dirname(__file__), "models"),
"stubs_path" : os.path.join(os.path.dirname(__file__), "stubs"),
"views_path" : os.path.join(os.path.dirname(__file__), "views")
}
myapp = {
"app_name" : "redmonty",
# Format : Content-Type Header
"supported_formats" : { "json" : "application/json", "csv" : "text/csv",
"xml" : "application/xml", "html" : "text/html",
"js" : "application/javascript",
"map" : "text/plain"},
"default_format" : "json",
"encoder" : {
"json" : redmonty.encoders.json_to_json(),
"csv" : redmonty.encoders.json_to_csv(),
"xml" : redmonty.encoders.json_to_xml()
},
"byte_decoding" : "utf-8",
"upload_path" : os.path.join(server_settings["static_path"], "upload"), #this is just a demo.
"page_size" : 5,
"enable_auth" : False, # False, simple or custom
"sql_auto_schema" : True,
"logfile" : os.path.join(os.path.dirname(__file__),"pow.log"),
"logformat" : logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'),
"id_pattern" : "[0-9\-a-zA-Z]+", # the regex used to math IDs in URLs (uuid in this case)
"date_format" : "%Y-%m-%d",
"datetime_format" : "%Y-%m-%d %H:%M:%S",
"html_datetime_format" : "%Y-%m-%dT%H:%M:%S",
"internal_fields" : ["created_at", "last_updated", "_uuid"], # these are not included in the scaffolded views at all
"password_fields" : ["passwd", "password"], # fields with these names will be displayed as input type password
"default_rest_route": "list",
"list_separator" : " ",
"pwhash_method" : "pbkdf2:sha256", # see: http://werkzeug.pocoo.org/docs/0.14/utils/#module-werkzeug.security
"simple_conversion": True
#"environment" : "development" # set the current environment (also see the db section)
}
BASE_DIR = os.path.dirname(__file__)
database = {
"default_values": {
"string" : "",
"integer" : 0,
"float" : 0.0,
"list" : [],
"boolean" : False,
"datetime" : datetime.datetime.utcnow(),
"dict" : {},
"binary" : None
},
"sql" : {
"loglevel" : logging.INFO,
"yield_per" : 100,
#
# this is an example for SQlite
#
"type" : "sqlite", #or: "db+driver" e.g. => "postgres+psycopg2" ...
"dbname" : os.path.join(BASE_DIR, 'db.sqlite'), # just a name for non file based DBs
"host" : None,
"port" : None,
"user" : None,
"passwd" : None,
"enabled" : False
#
# this is an example for Postgres (psycopg2 driver) you can use your preferred driver of course
#
# "type" : "postgres+psycopg2",
# "dbname" : "powdb",
# "host" : "localhost",
# "port" : 5432,
# "user" : "postgres",
# "passwd" : "postgres",
# "enabled" : False
#
# this is an example for MariaDB / MySQL
#
# "type" : "mysql+pymysql",
# "dbname" : "test", # just a name for non file based DBs
# "host" : "127.0.0.1",
# "port" : 3306,
# "user" : "<you db user here>",
# "passwd" : "<your db pwd here>",
# "enabled" : False
},
"tinydb" : {
"dbname" : './tiny.db',
"host" : None,
"port" : None,
"user" : None,
"passwd" : None,
"enabled" : True
},
"mongodb" : {
"dbname" : "testdb",
"atlas" : False,
"atlas_cstr": "", # usually just copy the Atlas connection string here
"urlencode" : False, # if set to True you need to give usr / pwd below
"atlas_user": "", # will be urllib.parse.quoted
"atlas_pwd" : "", # will still be raw
"host" : "localhost",
"port" : 27017,
"user" : None,
"passwd" : None,
#"indexes" : { "collection" : ([("field", pymongo.ASCENDING)], { "unique" : True } )},
"indexes" : {},
"enabled" : False
},
"elastic" : {
"dbname" : "testdb", # == elasticsearch index
"hosts" : ["localhost"],
"port" : 9200,
"user" : None,
"passwd" : None,
"enabled" : False
},
"redis" : {
"dbname" : 0, # zero starting numeric index for redis
"host" : "redis",
"port" : 6379,
"passwd" : "",
"strict" : True
}
}
redisui = {
"update_freq" : 3000, # miliseconds
"redis_conf" : "/etc/redis/redis.conf", # only if running on the redis host...
"scan_max" : 5
}
mydash={
# see: https://dash.plot.ly/getting-started
"external_stylesheets" : [],
"external_scripts" : []
}
beta_settings = {
# Beta settings are erxperimental. You can find details for each Beta setting
# on www.pythononwheels.org/beta
# Name : Enabled ?
"dot_format" : True
}