How are you invoking manage.py?  Try cd'ing to the directory containing it
before running it and see if that helps.  (That directory will then
automatically be on python's sys.path, which is needed.
DJANGO_SETTINGS_MODULE must be a python style package.module style path,
not a filesystem path, so depending on what yout mean by "path to project"
I wouldn't expect your second approach to work either.)

On Wed, Feb 13, 2013 at 1:57 AM, kulbhushan patariya <
kulbhushan4...@gmail.com> wrote:

> Hi,
> I have following problem regarding Django.
> Can anyone help me out
> ------------------------------**------------------------------**
> -----------------
> kbjp@kbjp-VGN-CS35GN-B:~/**Desktop/kbproject/firstjango$ django-admin.py
> syncdb
> Traceback (most recent call last):
>   File "/usr/local/bin/django-admin.**py", line 5, in <module>
>     management.execute_from_**command_line()
>   File 
> "/usr/local/lib/python2.7/**dist-packages/django/core/**management/__init__.py",
> line 443, in execute_from_command_line
>     utility.execute()
>   File 
> "/usr/local/lib/python2.7/**dist-packages/django/core/**management/__init__.py",
> line 382, in execute
>     self.fetch_command(subcommand)**.run_from_argv(self.argv)
>   File 
> "/usr/local/lib/python2.7/**dist-packages/django/core/**management/__init__.py",
> line 261, in fetch_command
>     klass = load_command_class(app_name, subcommand)
>   File 
> "/usr/local/lib/python2.7/**dist-packages/django/core/**management/__init__.py",
> line 69, in load_command_class
>     module = import_module('%s.management.**commands.%s' % (app_name,
> name))
>   File "/usr/local/lib/python2.7/**dist-packages/django/utils/**importlib.py",
> line 35, in import_module
>     __import__(name)
>   File "/usr/local/lib/python2.7/**dist-packages/django/core/**
> management/commands/syncdb.py"**, line 8, in <module>
>     from django.core.management.sql import custom_sql_for_model,
> emit_post_sync_signal
>   File 
> "/usr/local/lib/python2.7/**dist-packages/django/core/**management/sql.py",
> line 6, in <module>
>     from django.db import models
>   File "/usr/local/lib/python2.7/**dist-packages/django/db/__**init__.py",
> line 11, in <module>
>     if DEFAULT_DB_ALIAS not in settings.DATABASES:
>   File 
> "/usr/local/lib/python2.7/**dist-packages/django/utils/**functional.py",
> line 184, in inner
>     self._setup()
>   File "/usr/local/lib/python2.7/**dist-packages/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.
>
>
>
> Here is the content of manage.py file
>
> --------------------------------------------------------------------------------------------------------------------
> *#!/usr/bin/env python*
> *import os*
> *import sys*
> *
> *
> *if __name__ == "__main__":*
> *    os.environ.setdefault("DJANGO_SETTINGS_MODULE",
> "firstjango.settings")*
> *
> *
> *    from django.core.management import execute_from_command_line*
> *
> *
> *    execute_from_command_line(sys.argv)*
>
>
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Here is the error which i received after executing export
> DJANGO_SETTINGS_MODULE=**"path to project"
>
>
> ------------------------------**------------------------------**--------
> kbjp@kbjp-VGN-CS35GN-B:~/**Desktop/kbproject/firstjango$ export
> DJANGO_SETTINGS_MODULE=**firstjango.settings
> kbjp@kbjp-VGN-CS35GN-B:~/**Desktop/kbproject/firstjango$ django-admin.py
> syncdb
> Traceback (most recent call last):
>   File "/usr/local/bin/django-admin.**py", line 5, in <module>
>     management.execute_from_**command_line()
>   File 
> "/usr/local/lib/python2.7/**dist-packages/django/core/**management/__init__.py",
> line 443, in execute_from_command_line
>     utility.execute()
>   File 
> "/usr/local/lib/python2.7/**dist-packages/django/core/**management/__init__.py",
> line 382, in execute
>     self.fetch_command(subcommand)**.run_from_argv(self.argv)
>   File 
> "/usr/local/lib/python2.7/**dist-packages/django/core/**management/__init__.py",
> line 261, in fetch_command
>     klass = load_command_class(app_name, subcommand)
>   File 
> "/usr/local/lib/python2.7/**dist-packages/django/core/**management/__init__.py",
> line 69, in load_command_class
>     module = import_module('%s.management.**commands.%s' % (app_name,
> name))
>   File "/usr/local/lib/python2.7/**dist-packages/django/utils/**importlib.py",
> line 35, in import_module
>     __import__(name)
>   File "/usr/local/lib/python2.7/**dist-packages/django/core/**
> management/commands/syncdb.py"**, line 8, in <module>
>     from django.core.management.sql import custom_sql_for_model,
> emit_post_sync_signal
>   File 
> "/usr/local/lib/python2.7/**dist-packages/django/core/**management/sql.py",
> line 6, in <module>
>     from django.db import models
>   File "/usr/local/lib/python2.7/**dist-packages/django/db/__**init__.py",
> line 11, in <module>
>     if DEFAULT_DB_ALIAS not in settings.DATABASES:
>   File 
> "/usr/local/lib/python2.7/**dist-packages/django/utils/**functional.py",
> line 184, in inner
>     self._setup()
>   File "/usr/local/lib/python2.7/**dist-packages/django/conf/__**init__.py",
> line 42, in _setup
>     self._wrapped = Settings(settings_module)
>   File "/usr/local/lib/python2.7/**dist-packages/django/conf/__**init__.py",
> line 95, in __init__
>     raise ImportError("Could not import settings '%s' (Is it on
> sys.path?): %s" % (self.SETTINGS_MODULE, e))
> ImportError: Could not import settings 'firstjango.settings' (Is it on
> sys.path?): No module named firstjango.settings
> kbjp@kbjp-VGN-CS35GN-B:~/**Desktop/kbproject/firstjango$
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to