Comments (6)
Oh wait, that's actually not fixed. Sigh.
from django-configurations.
Okay, I think the main issue is that for some reason the notebook doesn't get the same environment as the main process (I guess because it runs in tornado in a different process).
Can you try configuring your iPython to have a exec_lines
configuration as mentioned on http://ipython.org/ipython-doc/stable/config/ipython.html#application-level-configuration?
Something along the lines of:
c = get_config()
c.InteractiveShellApp.exec_lines = [
'from configurations import importer; importer.install()'
]
If that works I could try writing a iPython extension that does the same which makes it a bit easier.
from django-configurations.
It partially works! I made a file called "ipython_config.py" with what you suggested. It doesn't have the same error anymore but I'm getting this instead because I'm using geodjango. I'm not sure where I should direct the problem but here it is:
---------------------------------------------------------------------------
ImproperlyConfigured Traceback (most recent call last)
<ipython-input-1-766d353a4f6a> in <module>()
----> 1 from people.models import Person
/home/django/.virtualenvs/astrobiology-alpha/src/people/people/models.py in <module>()
1 import re
----> 2 from django.db import models
3 from collections import OrderedDict
4 from django.template.defaultfilters import slugify
5 from django.conf import settings
/home/django/.virtualenvs/astrobiology-alpha/local/lib/python2.7/site-packages/django/db/__init__.py in <module>()
38
39 connection = DefaultConnectionProxy()
---> 40 backend = load_backend(connection.settings_dict['ENGINE'])
41
42 # Register an event that closes the database connection
/home/django/.virtualenvs/astrobiology-alpha/local/lib/python2.7/site-packages/django/db/__init__.py in __getattr__(self, item)
32 """
33 def __getattr__(self, item):
---> 34 return getattr(connections[DEFAULT_DB_ALIAS], item)
35
36 def __setattr__(self, name, value):
/home/django/.virtualenvs/astrobiology-alpha/local/lib/python2.7/site-packages/django/db/utils.pyc in __getitem__(self, alias)
91 self.ensure_defaults(alias)
92 db = self.databases[alias]
---> 93 backend = load_backend(db['ENGINE'])
94 conn = backend.DatabaseWrapper(db, alias)
95 setattr(self._connections, alias, conn)
/home/django/.virtualenvs/astrobiology-alpha/local/lib/python2.7/site-packages/django/db/utils.pyc in load_backend(backend_name)
43 "is one of:\n %s\nError was: %s" %
44 (backend_name, ", ".join(backend_reprs), e_user))
---> 45 raise ImproperlyConfigured(error_msg)
46 else:
47 # If there's some other error, this must be an error in Django
ImproperlyConfigured: 'django.contrib.gis.db.backends.postgis' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
u'mysql', u'oracle', u'postgresql_psycopg2', u'sqlite3'
Error was: cannot import name utils
from django-configurations.
Huh, that's odd, this is similar to https://code.djangoproject.com/ticket/16136 Which versions of Python and Django are you running?
from django-configurations.
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
Django 1.5.1
from django-configurations.
@typeshige Can you try again with the current master by following the cookbook: http://django-configurations.readthedocs.org/en/latest/cookbook/#ipython-notebooks?
from django-configurations.
Related Issues (20)
- Use the 'furo' theme for Sphinx documentation
- Improve code blocks in documentation
- Release minor version 2.4.1 HOT 3
- 2.4.1: pytest is failing HOT 2
- Replace deprecated imp module with importlib HOT 4
- How can this be used with `django.setup()` HOT 2
- Make magical importing optional
- <frozen importlib._bootstrap>:1049: ImportWarning: ConfigurationImporter.find_spec() not found; falling back to find_module() HOT 4
- "STATICFILES_STORAGE/STORAGES are mutually exclusive" on Django>=4.2
- WSGI application loaded twice unexpectedly
- Release 2.4.2 is not on PyPI HOT 9
- Update Python and Django supported versions
- Add support for Python 3.12 HOT 1
- DeprecationWarning for USE_DEPRECATED_PYTZ, CSRF_COOKIE_MASKED, USE_L10N
- Broken link in `Configuration.load_dotenv` docstring HOT 1
- Add Django 5.0 classifier
- Publish version 2.5.1 on PyPi HOT 2
- Values not working in DATABASES dictionary and values.Value returning Value instance type instead of a str HOT 1
- DOTENV - Using environ_name strange behevior HOT 1
- 2.5.1: documentation build fails
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-configurations.