← Back to team overview

graphite-dev team mailing list archive

Re: [Question #178172]: OperationalError: unable to open database file

 

Hi Sanjaya,
This just means django can't find the graphite settings module. That is its
not defined as an environmental variable or in the apache config.
Attached is doc on this. A typical setting looks like this: export
DJANGO_SETTINGS_MODULE=graphite.settings
Your setup may differ so please consult the django documentation.
https://docs.djangoproject.com/en/dev/topics/settings/


On Sun, Mar 18, 2012 at 10:15 PM, sanjaya dahal <
question178172@xxxxxxxxxxxxxxxxxxxxx> wrote:

> Question #178172 on Graphite changed:
> https://answers.launchpad.net/graphite/+question/178172
>
> sanjaya dahal posted a new comment:
> hi i tried to run django-admin sync db got following  errors
> django-admin syncdb
> Traceback (most recent call last):
>  File "/usr/bin/django-admin", line 5, in <module>
>    management.execute_from_command_line()
>  File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py",
> line 429, in execute_from_command_line
>    utility.execute()
>  File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py",
> line 379, in execute
>    self.fetch_command(subcommand).run_from_argv(self.argv)
>  File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py",
> line 261, in fetch_command
>    klass = load_command_class(app_name, subcommand)
>  File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py",
> line 67, in load_command_class
>    module = import_module('%s.management.commands.%s' % (app_name, name))
>  File "/usr/lib/pymodules/python2.7/django/utils/importlib.py", line 35,
> in import_module
>    __import__(name)
>  File
> "/usr/lib/pymodules/python2.7/django/core/management/commands/syncdb.py",
> line 7, in <module>
>    from django.core.management.sql import custom_sql_for_model,
> emit_post_sync_signal
>  File "/usr/lib/pymodules/python2.7/django/core/management/sql.py", line
> 6, in <module>
>    from django.db import models
>  File "/usr/lib/pymodules/python2.7/django/db/__init__.py", line 14, in
> <module>
>    if not settings.DATABASES:
>  File "/usr/lib/pymodules/python2.7/django/utils/functional.py", line 276,
> in __getattr__
>    self._setup()
>  File "/usr/lib/pymodules/python2.7/django/conf/__init__.py", line 40, in
> _setup
>    raise ImportError("Settings cannot be imported, because environment
> variable %s is undefined." % ENVIRONMENT_VARIABLE)
> ImportError: Settings cannot be imported, because environment variable
> DJANGO_SETTINGS_MODULE is undefined.
>
>
> On Mon, Mar 19, 2012 at 3:10 AM, cbrinley <
> question178172@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
> > Question #178172 on Graphite changed:
> > https://answers.launchpad.net/graphite/+question/178172
> >
> > cbrinley posted a new comment:
> > As a start i'd recommend either running the django syncdb or perhaps the
> > sqlite file has the wrong ownership / permissions. Could potentially be
> > another cause but that is an initial suggestion.
> > On Mar 18, 2012 8:57 PM, "sanjaya dahal" <
> > question178172@xxxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > > Question #178172 on Graphite changed:
> > > https://answers.launchpad.net/graphite/+question/178172
> > >
> > > sanjaya dahal posted a new comment:
> > > hi can any body explain what this error is
> > > Traceback:
> > > File "/usr/lib/pymodules/python2.7/django/core/handlers/base.py" in
> > > get_response
> > >  178.                 response = middleware_method(request, response)
> > > File
> "/usr/lib/pymodules/python2.7/django/contrib/sessions/middleware.py"
> > > in process_response
> > >  36.                 request.session.save()
> > > File
> > "/usr/lib/pymodules/python2.7/django/contrib/sessions/backends/db.py"
> > > in save
> > >  56.             session_key = self.session_key,
> > > File
> > > "/usr/lib/pymodules/python2.7/django/contrib/sessions/backends/base.py"
> > in
> > > _get_session_key
> > >  175.             self._session_key = self._get_new_session_key()
> > > File
> > > "/usr/lib/pymodules/python2.7/django/contrib/sessions/backends/base.py"
> > in
> > > _get_new_session_key
> > >  167.             if not self.exists(session_key):
> > > File
> > "/usr/lib/pymodules/python2.7/django/contrib/sessions/backends/db.py"
> > > in exists
> > >  29.             Session.objects.get(session_key=session_key)
> > > File "/usr/lib/pymodules/python2.7/django/db/models/manager.py" in get
> > >  132.         return self.get_query_set().get(*args, **kwargs)
> > > File "/usr/lib/pymodules/python2.7/django/db/models/query.py" in get
> > >  344.         num = len(clone)
> > > File "/usr/lib/pymodules/python2.7/django/db/models/query.py" in
> __len__
> > >  82.                 self._result_cache = list(self.iterator())
> > > File "/usr/lib/pymodules/python2.7/django/db/models/query.py" in
> iterator
> > >  273.         for row in compiler.results_iter():
> > > File "/usr/lib/pymodules/python2.7/django/db/models/sql/compiler.py" in
> > > results_iter
> > >  680.         for rows in self.execute_sql(MULTI):
> > > File "/usr/lib/pymodules/python2.7/django/db/models/sql/compiler.py" in
> > > execute_sql
> > >  734.         cursor = self.connection.cursor()
> > > File "/usr/lib/pymodules/python2.7/django/db/backends/__init__.py" in
> > > cursor
> > >  250.             cursor = self.make_debug_cursor(self._cursor())
> > > File "/usr/lib/pymodules/python2.7/django/db/backends/sqlite3/base.py"
> in
> > > _cursor
> > >  207.             self.connection = Database.connect(**kwargs)
> > >
> > > Exception Type: OperationalError at /auth/login/
> > > Exception Value: unable to open database file
> > >
> > > --
> > > You received this question notification because you are a member of
> > > graphite-dev, which is an answer contact for Graphite.
> > >
> > > _______________________________________________
> > > Mailing list: https://launchpad.net/~graphite-dev
> > > Post to     : graphite-dev@xxxxxxxxxxxxxxxxxxx
> > > Unsubscribe : https://launchpad.net/~graphite-dev
> > > More help   : https://help.launchpad.net/ListHelp
> > >
> >
> > --
> > You received this question notification because you are a direct
> > subscriber of the question.
> >
>
> --
> You received this question notification because you are a member of
> graphite-dev, which is an answer contact for Graphite.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~graphite-dev
> Post to     : graphite-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~graphite-dev
> More help   : https://help.launchpad.net/ListHelp
>



-- 


Chris Brinley
Cleartrial

e: cbrinley@xxxxxxxxxxxxxx
p: 312-460-3038
m: 219-789-2811

Follow ups

References