##// END OF EJS Templates
core: use common bootstrap for pyramid app
marcink -
r2189:bf1dfb34 default
parent child Browse files
Show More
@@ -1,61 +1,59 b''
1 1 # -*- coding: utf-8 -*-
2 2
3 3 # Copyright (C) 2016-2017 RhodeCode GmbH
4 4 #
5 5 # This program is free software: you can redistribute it and/or modify
6 6 # it under the terms of the GNU Affero General Public License, version 3
7 7 # (only), as published by the Free Software Foundation.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU Affero General Public License
15 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16 #
17 17 # This program is dual-licensed. If you wish to learn more about the
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import click
22 22
23 from pyramid.paster import bootstrap
24 from pyramid.request import Request
23 from rhodecode.lib.pyramid_utils import bootstrap
25 24 import pyramid.paster
26 25
27 26 # imports, used in ipython shell
28 27 import os
29 28 import sys
30 29 import time
31 30 import shutil
32 31 import datetime
33 32 from rhodecode.model.db import *
34 33
35 34 welcome_banner = """Welcome to RhodeCode iShell.
36 35 Type `exit` to exit the shell.
37 36 iShell is interactive shell to interact directly with the
38 37 internal RhodeCode APIs. You can rescue your lost password,
39 38 or reset some user/system settings.
40 39 """
41 40
42 41
43 42 @click.command()
44 43 @click.argument('ini_path', type=click.Path(exists=True))
45 44 def main(ini_path):
46 45 pyramid.paster.setup_logging(ini_path)
47 46
48 request = Request.blank('/', base_url='https://rhodecode-app.com/')
49 with bootstrap(ini_path, request=request) as env:
47 with bootstrap(ini_path) as env:
50 48
51 49 try:
52 50 from IPython import embed
53 51 from traitlets.config import Config
54 52 cfg = Config()
55 53 cfg.InteractiveShellEmbed.confirm_exit = False
56 54 embed(config=cfg, banner1=welcome_banner)
57 55 except ImportError:
58 56 print('ipython installation required for ishell')
59 57 sys.exit(-1)
60 58
61 59
@@ -1,35 +1,33 b''
1 1 # -*- coding: utf-8 -*-
2 2
3 3 # Copyright (C) 2016-2017 RhodeCode GmbH
4 4 #
5 5 # This program is free software: you can redistribute it and/or modify
6 6 # it under the terms of the GNU Affero General Public License, version 3
7 7 # (only), as published by the Free Software Foundation.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU Affero General Public License
15 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16 #
17 17 # This program is dual-licensed. If you wish to learn more about the
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import click
22 22
23 from pyramid.paster import bootstrap
24 from pyramid.request import Request
23 from rhodecode.lib.pyramid_utils import bootstrap
25 24 import pyramid.paster
26 25
27 26
28 27 @click.command()
29 28 @click.argument('ini_path', type=click.Path(exists=True))
30 29 def main(ini_path):
31 30 pyramid.paster.setup_logging(ini_path)
32 31
33 request = Request.blank('/', base_url='https://rhodecode-app.com/')
34 with bootstrap(ini_path, request=request) as env:
32 with bootstrap(ini_path) as env:
35 33 print(env['request'].application_url) No newline at end of file
@@ -1,37 +1,35 b''
1 1 # -*- coding: utf-8 -*-
2 2
3 3 # Copyright (C) 2016-2017 RhodeCode GmbH
4 4 #
5 5 # This program is free software: you can redistribute it and/or modify
6 6 # it under the terms of the GNU Affero General Public License, version 3
7 7 # (only), as published by the Free Software Foundation.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU Affero General Public License
15 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16 #
17 17 # This program is dual-licensed. If you wish to learn more about the
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import click
22 22
23 from pyramid.paster import bootstrap
24 from pyramid.request import Request
23 from rhodecode.lib.pyramid_utils import bootstrap
25 24 import pyramid.paster
26 25
27 26
28 27 @click.command()
29 28 @click.argument('ini_path', type=click.Path(exists=True))
30 29 def main(ini_path):
31 30 pyramid.paster.setup_logging(ini_path)
32 31
33 request = Request.blank('/', base_url='https://rhodecode-app.com/')
34 with bootstrap(ini_path, request=request) as env:
32 with bootstrap(ini_path) as env:
35 33 print(env['request'].application_url)
36 34
37 35
General Comments 0
You need to be logged in to leave comments. Login now