def configure(globals_dict, settings_module_name=None): """ Same as :func:`atelier.sphinxconf.configure` but with an additional positional argument `settings_module_name` (the name of a Django settings module). If this argument is specified, call :meth:`lino.startup` with it. """ if settings_module_name is not None: from lino import startup startup(settings_module_name) print("Django started with DJANGO_SETTINGS_MODULE={}.".format(settings_module_name)) from django.conf import settings print(settings.SITE.welcome_text()) # print(settings.SITE.diagnostic_report_rst()) # os.environ['DJANGO_SETTINGS_MODULE'] = settings_module_name # # Trigger loading of Djangos model cache in order to avoid # # side effects that would occur when this happens later while # # importing one of the models modules. # from django.conf import settings # settings.SITE.startup() # globals_dict.update( # template_bridge=str('lino.sphinxcontrib.DjangoTemplateBridge')) intersphinx_mapping = globals_dict.setdefault('intersphinx_mapping', dict()) intersphinx_mapping['cg'] = ('https://community.lino-framework.org/', None) intersphinx_mapping['book'] = ('https://www.lino-framework.org/', None) return sphinxconf.configure(globals_dict)
def configure(globals_dict, settings_module_name=None): """Same as :func:`atelier.sphinxconf.configure` but with an additional positional parameter `settings_module_name`. If this is specified, call lino startup on it. """ if settings_module_name is not None: from lino import startup startup(settings_module_name) # os.environ['DJANGO_SETTINGS_MODULE'] = settings_module_name # # Trigger loading of Djangos model cache in order to avoid # # side effects that would occur when this happens later while # # importing one of the models modules. # from django.conf import settings # settings.SITE.startup() globals_dict.update( template_bridge=str('atelier.sphinxconf.DjangoTemplateBridge')) return sphinxconf.configure(globals_dict)
def configure(globals_dict, settings_module_name=None): """ Same as :func:`atelier.sphinxconf.configure` but with an additional positional argument `settings_module_name` (the name of a Django settings module). If this argument is specified, call :meth:`lino.startup` with it. """ if settings_module_name is not None: from lino import startup startup(settings_module_name) # os.environ['DJANGO_SETTINGS_MODULE'] = settings_module_name # # Trigger loading of Djangos model cache in order to avoid # # side effects that would occur when this happens later while # # importing one of the models modules. # from django.conf import settings # settings.SITE.startup() # globals_dict.update( # template_bridge=str('lino.sphinxcontrib.DjangoTemplateBridge')) return sphinxconf.configure(globals_dict)
As an application developer you don't need to worry about this. This is found by Django because :mod:`lino.projects.std.settings` :setting:`ROOT_URLCONF` is set to :mod:`lino.core.urls`. """ from django.conf import settings from django.conf.urls import url, include from django.conf.urls.static import static from lino.core.signals import database_ready from lino.core.utils import is_devserver import lino lino.startup() # we must explicitly call django.setup() because when running under # mod_wsgi this is not done automatically as with runserver (or at # least it seems so) lino.site_startup() site = settings.SITE urlpatterns = [] database_ready.send(site) if site.site_prefix: prefix = site.site_prefix[1:] else: prefix = "" rx = "^" + prefix
"""The default URLconf module for Lino applications. As an application developer you don't need to worry about this. This is found by Django because :mod:`lino.projects.std.settings` :setting:`ROOT_URLCONF` is set to :mod:`lino.core.urls`. """ from django.conf import settings from django.conf.urls import url, include from django.conf.urls.static import static from lino.core.signals import database_ready from lino.core.utils import is_devserver import lino lino.startup() # we must explicitly call django.setup() because when running under # mod_wsgi this is not done automatically as with runserver (or at # least it seems so) lino.site_startup() site = settings.SITE urlpatterns = [] database_ready.send(site) if site.site_prefix: prefix = site.site_prefix[1:] else: prefix = '' rx = '^' + prefix
def configure(globals_dict, settings_module_name=None): """Adds to your `conf.py` an arbitrary series of things that all my Sphinx docs configuration files have in common. To be called from inside the Sphinx `conf.py` as follows:: from djangosite.utils.sphinxconf import configure configure(globals()) Incomplete list of `conf.py` settings that will be set: - `extensions` - `templates_path` - `html_static_path` - master_doc='index' - source_suffix='.rst' - primary_domain='py' - pygments_style='sphinx' """ filename = globals_dict.get('__file__') sys.path.append(Path(filename).parent.absolute()) globals_dict.update(extensions=[ 'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.inheritance_diagram', 'sphinx.ext.todo', 'sphinx.ext.extlinks', 'sphinx.ext.graphviz', 'sphinx.ext.intersphinx', # no i18n, no discovery, only one entry per doc, # 'sphinxcontrib.newsfeed', #~ 'sphinx.ext.doctest', 'atelier.sphinxconf.base', 'atelier.sphinxconf.dirtables', 'atelier.sphinxconf.refstothis', 'atelier.sphinxconf.insert_input', ]) # default config for autosummary: globals_dict.update(autosummary_generate=True) globals_dict.update(autodoc_default_flags=['members']) if settings_module_name is not None: from lino import startup startup(settings_module_name) # os.environ['DJANGO_SETTINGS_MODULE'] = settings_module_name # # Trigger loading of Djangos model cache in order to avoid # # side effects that would occur when this happens later while # # importing one of the models modules. # from django.conf import settings # settings.SITE.startup() globals_dict.update( template_bridge=str('atelier.sphinxconf.DjangoTemplateBridge')) mydir = Path(__file__).parent.absolute() globals_dict.update(templates_path=['.templates', mydir]) # globals_dict.update(html_static_path=['.static']) # some settings i use in all projects: globals_dict.update(master_doc='index') globals_dict.update(source_suffix='.rst') globals_dict.update(primary_domain='py') globals_dict.update(pygments_style='sphinx') globals_dict.update(autodoc_member_order='bysource') globals_dict.update(autodoc_default_flags=['show-inheritance', 'members']) my_font_family = "Swiss, Helvetica, 'Liberation Sans'" globals_dict.update(html_theme_options={ "font_family": my_font_family, "head_font_family": my_font_family, })