forked from fedora-infra/packagedb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-pkgdb.in
executable file
·38 lines (29 loc) · 1.06 KB
/
start-pkgdb.in
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
#!/usr/bin/python
__requires__ = 'TurboGears'
import os.path
import sys
CONFDIR='@CONFDIR@'
PKGDBDIR=os.path.join('@DATADIR@', 'fedora-packagedb')
sys.path.append(PKGDBDIR)
import pkg_resources
from turbogears import config, update_config, start_server, startup
import cherrypy
import fedora.tg.utils
cherrypy.lowercase_api = True
config.update({'pkgdb.basedir': PKGDBDIR})
# first look on the command line for a desired config file,
# if it's not on the command line, then
# look for setup.py in this directory. If it's not there, this script is
# probably installed
if len(sys.argv) > 1:
update_config(configfile=sys.argv[1],
modulename="pkgdb.config")
elif os.path.exists(os.path.join(os.path.dirname(__file__), "setup.py")):
update_config(configfile="pkgdb.cfg",modulename="pkgdb.config")
else:
update_config(configfile=os.path.join(CONFDIR,'pkgdb.cfg'),modulename="pkgdb.config")
import pkgdb.lib.utils
pkgdb.lib.utils.init_globals()
startup.call_on_startup.append(fedora.tg.utils.enable_csrf)
from pkgdb.controllers import Root
start_server(Root())