forked from infogami/infogami
-
Notifications
You must be signed in to change notification settings - Fork 26
/
sample_run.py
47 lines (34 loc) · 1.02 KB
/
sample_run.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
"""
Sample run.py
"""
import infogami
# your db parameters
infogami.config.db_parameters = dict(
dbn='postgres', db="infogami", user='yourname', pw=''
)
# site name
infogami.config.site = 'infogami.org'
infogami.config.admin_password = "admin123"
# add additional plugins and plugin path
# infogami.config.plugin_path += ['plugins']
# infogami.config.plugins += ['search']
def createsite():
import web
from infogami.infobase import config, dbstore, infobase, server
web.config.db_parameters = infogami.config.db_parameters
web.config.db_printing = True
web.ctx.ip = '127.0.0.1'
server.app.request('/')
schema = dbstore.Schema()
store = dbstore.DBStore(schema)
ib = infobase.Infobase(store, config.secret_key)
ib.create(infogami.config.site)
if __name__ == "__main__":
import sys
if '--schema' in sys.argv:
from infogami.infobase.dbstore import Schema
print(Schema().sql())
elif '--createsite' in sys.argv:
createsite()
else:
infogami.run()