mirror of
https://github.com/jazzband/django-configurations.git
synced 2026-03-16 22:20:27 +00:00
Added iPython extension to make sure the import hook is loaded correctly.
Fixes #22.
This commit is contained in:
parent
924daa385d
commit
50a6a6ad0b
2 changed files with 46 additions and 0 deletions
|
|
@ -4,3 +4,12 @@ from .decorators import pristinemethod
|
|||
|
||||
__version__ = '0.5.1'
|
||||
__all__ = ['Configuration', 'pristinemethod', 'Settings']
|
||||
|
||||
|
||||
def load_ipython_extension(ipython):
|
||||
# The `ipython` argument is the currently active `InteractiveShell`
|
||||
# instance, which can be used in any way. This allows you to register
|
||||
# new magics or aliases, for example.
|
||||
from . import importer
|
||||
|
||||
importer.install()
|
||||
|
|
|
|||
|
|
@ -94,6 +94,43 @@ probably just add the following to the **beginning** of your settings module::
|
|||
|
||||
That has the same effect as using the ``manage.py`` or ``wsgi.py`` utilities.
|
||||
|
||||
iPython notebooks
|
||||
-----------------
|
||||
|
||||
.. versionadded:: 0.6
|
||||
|
||||
To use django-configurations with IPython_'s great notebooks, you have to
|
||||
enable an extension in your IPython configuration. See the IPython
|
||||
documentation for how to create and `manage your IPython profile`_ correctly.
|
||||
|
||||
Here's a quick how-to in case you don't have a profile yet. Type in your
|
||||
command line shell::
|
||||
|
||||
ipython profile create
|
||||
|
||||
Then let IPython show you where the configuration file ``ipython_config.py``
|
||||
was created::
|
||||
|
||||
ipython locate profile
|
||||
|
||||
That should print a directory path where you can find the
|
||||
``ipython_config.py`` configuration file. Now open that file and extend the
|
||||
``c.InteractiveShellApp.extensions`` configuration value. It may be commented
|
||||
out from when IPython created the file or it may not exist in the file at all.
|
||||
In either case make sure it's not a Python comment anymore and reads like this::
|
||||
|
||||
# A list of dotted module names of IPython extensions to load.
|
||||
c.InteractiveShellApp.extensions = [
|
||||
# .. your other extensions if available
|
||||
'configurations',
|
||||
]
|
||||
|
||||
That will tell IPython to load django-configurations correctly on startup.
|
||||
It also works with django-extensions's shell_plus_ management command.
|
||||
|
||||
.. _IPython: http://ipython.org/
|
||||
.. _`manage your IPython profile`: http://ipython.org/ipython-doc/dev/config/overview.html#configuration-file-location
|
||||
.. _shell_plus: http://django-extensions.readthedocs.org/en/latest/shell_plus.html
|
||||
|
||||
FastCGI
|
||||
-------
|
||||
|
|
|
|||
Loading…
Reference in a new issue