Show More
@@ -42,7 +42,7 b' BACKENDS = {' | |||||
42 |
|
42 | |||
43 | CELERY_APP = None # set to Celery app instance if using Celery |
|
43 | CELERY_APP = None # set to Celery app instance if using Celery | |
44 |
|
44 | |||
45 | CONFIG = {} |
|
45 | CONFIG = {} # set to tg.config when TG app is initialized and calls app_cfg | |
46 |
|
46 | |||
47 | # URL prefix for non repository related links - must start with `/` |
|
47 | # URL prefix for non repository related links - must start with `/` | |
48 | ADMIN_PREFIX = '/_admin' |
|
48 | ADMIN_PREFIX = '/_admin' |
@@ -76,12 +76,10 b' def register_command(needs_config_file=F' | |||||
76 | cp.read_string(read_config(path_to_ini_file, strip_section_prefix=annotated.__name__)) |
|
76 | cp.read_string(read_config(path_to_ini_file, strip_section_prefix=annotated.__name__)) | |
77 | logging.config.fileConfig(cp, |
|
77 | logging.config.fileConfig(cp, | |
78 | {'__file__': path_to_ini_file, 'here': os.path.dirname(path_to_ini_file)}) |
|
78 | {'__file__': path_to_ini_file, 'here': os.path.dirname(path_to_ini_file)}) | |
79 |
if config_file |
|
79 | if needs_config_file: | |
80 | if needs_config_file: # special case for db creation: also call annotated function (with config parameter) *before* app initialization |
|
|||
81 |
|
|
80 | annotated(*args, config=config, **kwargs) | |
|
81 | if config_file_initialize_app: | |||
82 | kallithea.config.application.make_app(config.global_conf, **config.local_conf) |
|
82 | kallithea.config.application.make_app(config.global_conf, **config.local_conf) | |
83 | else: |
|
|||
84 | kallithea.CONFIG = dict(config) # config is a dict subclass |
|
|||
85 | annotated(*args, **kwargs) |
|
83 | annotated(*args, **kwargs) | |
86 | return cli_command(runtime_wrapper) |
|
84 | return cli_command(runtime_wrapper) | |
87 | return annotator |
|
85 | return annotator |
@@ -24,20 +24,19 b' import os' | |||||
24 | import click |
|
24 | import click | |
25 | import pkg_resources |
|
25 | import pkg_resources | |
26 |
|
26 | |||
27 | import kallithea |
|
|||
28 | import kallithea.bin.kallithea_cli_base as cli_base |
|
27 | import kallithea.bin.kallithea_cli_base as cli_base | |
29 | from kallithea.lib.utils2 import ask_ok |
|
28 | from kallithea.lib.utils2 import ask_ok | |
30 |
|
29 | |||
31 |
|
30 | |||
32 | @cli_base.register_command(needs_config_file=True) |
|
31 | @cli_base.register_command(needs_config_file=True) | |
33 | def extensions_create(): |
|
32 | def extensions_create(config): | |
34 | """Write template file for extending Kallithea in Python. |
|
33 | """Write template file for extending Kallithea in Python. | |
35 |
|
34 | |||
36 | Create a template `extensions.py` file next to the ini file. Local |
|
35 | Create a template `extensions.py` file next to the ini file. Local | |
37 | customizations in that file will survive upgrades. The file contains |
|
36 | customizations in that file will survive upgrades. The file contains | |
38 | instructions on how it can be customized. |
|
37 | instructions on how it can be customized. | |
39 | """ |
|
38 | """ | |
40 |
here = |
|
39 | here = config['here'] | |
41 | content = pkg_resources.resource_string( |
|
40 | content = pkg_resources.resource_string( | |
42 | 'kallithea', os.path.join('templates', 'py', 'extensions.py') |
|
41 | 'kallithea', os.path.join('templates', 'py', 'extensions.py') | |
43 | ) |
|
42 | ) |
@@ -16,7 +16,6 b' import sys' | |||||
16 |
|
16 | |||
17 | import click |
|
17 | import click | |
18 |
|
18 | |||
19 | import kallithea |
|
|||
20 | import kallithea.bin.kallithea_cli_base as cli_base |
|
19 | import kallithea.bin.kallithea_cli_base as cli_base | |
21 |
|
20 | |||
22 |
|
21 | |||
@@ -60,10 +59,10 b" if __name__=='__main__':" | |||||
60 | @cli_base.register_command(needs_config_file=True) |
|
59 | @cli_base.register_command(needs_config_file=True) | |
61 | @click.option('--virtualdir', default='/', |
|
60 | @click.option('--virtualdir', default='/', | |
62 | help='The virtual folder to install into on IIS.') |
|
61 | help='The virtual folder to install into on IIS.') | |
63 | def iis_install(virtualdir): |
|
62 | def iis_install(virtualdir, config): | |
64 | """Install into IIS using isapi-wsgi.""" |
|
63 | """Install into IIS using isapi-wsgi.""" | |
65 |
|
64 | |||
66 |
config_file_abs = |
|
65 | config_file_abs = config['__file__'] | |
67 |
|
66 | |||
68 | try: |
|
67 | try: | |
69 | import isapi_wsgi |
|
68 | import isapi_wsgi |
General Comments 0
You need to be logged in to leave comments.
Login now