I see what you're doing, (It did take me half an hour of staring at your
email though)
The steps are:
$django-admin startproject myproj
$cd myproj
$vi myproj/settings.py
than add your databases
than run
$./manage.py syncdb
not django-admin syncdb
On 13/02/13 13:54, Bill Freeman wrote:
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 <mailto: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
<mailto:django-users%2bunsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto: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.
--
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.