-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
129 lines (121 loc) · 4.87 KB
/
config.py
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
#
#
# pow settings file
#
import simplejson as json
import medium.encoders
import os
import logging
import datetime
server_settings = {
"protocol" : "http://",
"host" : "localhost",
"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,
"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" : "1234"
}
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" : "pow",
"default_format" : "json",
"supported_formats" : ["json", "csv", "xml", "html"],
"encoder" : {
"json" : json,
"csv" : medium.encoders.JsonToCsv(),
"xml" : medium.encoders.JsonToXml()
},
"proxy" : False,
"upload_path" : os.path.join(server_settings["static_path"], "upload"), # the upload file path (just a demo here)
"upload_url" : "/static/upload", # the according upload URL path (For the handler)
"app_base_url" : server_settings["protocol"] + server_settings["host"] + ":" + str(server_settings["port"]),
"app_proxy_url" : server_settings["protocol"] + server_settings["host"],
"page_size" : 5,
"enable_authentication" : False, # False, simple or custom
"sql_auto_schema" : True,
"logfile" : os.path.join(os.path.dirname(__file__),"medium.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)
"list_separator" : ",",
"date_format" : "%Y-%m-%d %H:%M:%S",
"internal_fields" : ["created_at", "last_updated"], # these are not included in the scaffolded views at all
"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" : {
"type" : "sqlite",
"dbname" : os.path.join(BASE_DIR, 'db.sqlite'),
"host" : None,
"port" : None,
"user" : None,
"passwd" : None,
"enabled" : True # switch currently unused
},
"tinydb" : {
"dbname" : os.path.join(BASE_DIR, 'tiny.db'),
"host" : None,
"port" : None,
"user" : None,
"passwd" : None,
"enabled" : True # switch currently unused
},
"mongodb" : {
"dbname" : "testdb",
"atlas" : False,
"atlas_conn_str" : "mongodb+srv://<USER>:<PASSWORD>@cluster0-aetuw.mongodb.net/test", #this is just a sample
"host" : "localhost",
"port" : 27017,
"user" : None,
"passwd" : None,
"enabled" : False # switch currently unused
},
"elastic" : {
"dbname" : "testdb", # == elasticsearch index
"hosts" : ["localhost"],
"port" : 9200,
"user" : None,
"passwd" : None,
"enabled" : False # switch currently unused
}
}
beta_settings = {
# Beta settings are erxperimental. You can find details for each Beta setting
# on www.pythononwheels.org/beta
# Name : Enabled ?
"dot_format" : True
}
#from handlers.very_raw_own_handler import VeryRawOwnHandler
routes = [
#(r'.*', VeryRawOwnHandler)
]