Giter Site home page Giter Site logo

Comments (6)

jezdez avatar jezdez commented on May 28, 2024

Oh wait, that's actually not fixed. Sigh.

from django-configurations.

jezdez avatar jezdez commented on May 28, 2024

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.

typeshige avatar typeshige commented on May 28, 2024

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.

jezdez avatar jezdez commented on May 28, 2024

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.

typeshige avatar typeshige commented on May 28, 2024

Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
Django 1.5.1

from django-configurations.

jezdez avatar jezdez commented on May 28, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.