ightning@rigel5:~$ cd /home/lightning/Documents/django-works/mysite/
lightning@rigel5:~/Documents/django-works/mysite$ pathToDirectoryContainingManage_py$ python manage.py diffsettings
pathToDirectoryContainingManage_py$: command not found
lightning@rigel5:~/Documents/django-works/mysite$ pathToDirectoryContainingManage_py
pathToDirectoryContainingManage_py: command not found
lightning@rigel5:~/Documents/django-works/mysite$ ightning@rigel5:pathToDirectoryContainingManage_py$ python manage.py diffsettings
ightning@rigel5:pathToDirectoryContainingManage_py$: command not found
lightning@rigel5:~/Documents/django-works/mysite$ cd /manage.py
bash: cd: /manage.py: No such file or directory
lightning@rigel5:~/Documents/django-works/mysite$ export DJANGO_SETTINGS_MODULE='mysite.settings'
lightning@rigel5:~/Documents/django-works/mysite$ django-admin.py test
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 453, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, 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 263, in fetch_command
app_name = get_commands()[subcommand]
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 109, in get_commands
apps = settings.INSTALLED_APPS
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 52, in __getattr__
self._setup(name)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 47, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 132, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'mysite.settings' (Is it on sys.path?): No module named mysite.settings
lightning@rigel5:~/Documents/django-works/mysite$
On Thu, Mar 21, 2013 at 1:39 PM, Bill Freeman <ke1g.nh@gmail.com> wrote:
Setting an environment variable is done by saying something like:
lightning@rigel5:~$ export DJANGO_SETTINGS_MODULE='mysite.settings'
assuming that your settings.py file is in a directory named "mysite", in turn in the current directory (your home directory, if I interpret your prompt string correctly). Then that command may work.
But that's the painful way to do that. Presumably there is a file named manage.py either in the same directory as settings.py (older Djangos) or one directory up (newer Djangos). 'cd' to the directory containing manage.py and type:
lightning@rigel5:pathToDirectoryContainingManage_py$ python manage.py diffsettings
If you look at manage.py with 'less' or with an editor, you will see that it sets the DJANGO_SETTINGS_MODULE environment variable (though using python code, rather than shell code) appropriately (for use from the current directory) before doing other stuff.
For my money, django-admin.py should only ever be used for its startproject command. Everything else should be done with manage.py after cd'ing to the directory that contains it (or from a wsgi script, which also sets the DJANGO_SETTINGS_MODULE environment variable and adjusts sys.path to be sure that the directory containing manage.py is there, but that will come much later for you, I think).
BillOn Thu, Mar 21, 2013 at 1:13 PM, Lightning <hughmanchu11@gmail.com> wrote:
--
On Wednesday, March 20, 2013 11:50:49 PM UTC-7, Lightning wrote:
I need help configuring for a database. Is there a paper I can read that will give me an overview on this procedure? I encountered a core exception. My OS is Ubuntu 12.10 32 bit.
ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE" class LazySettings(LazyObject): """ A lazy proxy for either global Django settings or a custom settings object. The user can manually configure settings prior to using them. Otherwise, Django uses the settings module pointed to by DJANGO_SETTINGS_MODULE. """ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
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+unsubscribe@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 a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/h7BncMwxH7E/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@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+unsubscribe@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.
No comments:
Post a Comment