Opened 10 years ago
Closed 10 years ago
#22949 closed Bug (invalid)
django-admin.py startproject required settings
Reported by: | anonymous | Owned by: | Aymeric Augustin |
---|---|---|---|
Component: | Core (Management commands) | Version: | 1.7-rc-1 |
Severity: | Release blocker | Keywords: | django-admin |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
DJANGO_SETTINGS_MODULE not set, but starproject not may create new project, required setting variables.
bash-4.3# export | grep DJANGO_SETTINGS_MODULE
bash-4.3# ls
django-admin.py
bash-4.3# python -c "import django; print(django.get_version())"
1.8.dev20140703043303
bash-4.3# ./django-admin.py startproject myproject
Traceback (most recent call last):
File "./django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/usr/lib64/python2.7/site-packages/django/core/management/init.py", line 330, in execute_from_command_line
utility.execute()
File "/usr/lib64/python2.7/site-packages/django/core/management/init.py", line 304, in execute
django.setup()
File "/usr/lib64/python2.7/site-packages/django/init.py", line 20, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/usr/lib64/python2.7/site-packages/django/django/conf/init.py", line 46, in getattr
self._setup(name)
File "/usr/lib64/python2.7/site-packages/django/django/conf/init.py", line 40, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Change History (14)
comment:1 by , 10 years ago
Component: | Uncategorized → Core (Management commands) |
---|
comment:2 by , 10 years ago
Could you clarify the steps to reproduce the issue? I had no problem with the following:
$ mkvirtualenv django-test-22949 $ pip install https://www.djangoproject.com/download/1.7c1/tarball/ $ django-admin.py startproject myproject
comment:3 by , 10 years ago
I work via GIT
bash-4.3# cd /usr/src/devel/django
bash-4.3# git checkout master
Already on 'master'
bash-4.3# python -c "import django; print(django.get_version())"
1.8.dev20140703114252
bash-4.3# cd /sites/test_dj
bash-4.3# ./django-admin.py startproject myproject
Traceback (most recent call last):
File "./django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/usr/lib64/python2.7/site-packages/django/core/management/init.py", line 330, in execute_from_command_line
utility.execute()
File "/usr/lib64/python2.7/site-packages/django/core/management/init.py", line 304, in execute
django.setup()
File "/usr/lib64/python2.7/site-packages/django/init.py", line 20, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/usr/lib64/python2.7/site-packages/django/django/conf/init.py", line 46, in getattr
self._setup(name)
File "/usr/lib64/python2.7/site-packages/django/django/conf/init.py", line 40, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
bash-4.3# cd /usr/src/devel/django
bash-4.3# git checkout 1.7c1
Note: checking out '1.7c1'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 78bff08... [1.7.x] Bump version number for 1.7 RC 1.
bash-4.3# cd /sites/test_dj
bash-4.3# python -c "import django; print(django.get_version())"
1.7c1
bash-4.3# ./django-admin.py startproject myproject
Traceback (most recent call last):
File "./django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/usr/lib64/python2.7/site-packages/django/core/management/init.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/lib64/python2.7/site-packages/django/core/management/init.py", line 354, in execute
django.setup()
File "/usr/lib64/python2.7/site-packages/django/init.py", line 20, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/usr/lib64/python2.7/site-packages/django/django/conf/init.py", line 46, in getattr
self._setup(name)
File "/usr/lib64/python2.7/site-packages/django/django/conf/init.py", line 40, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
bash-4.3# cd /usr/src/devel/django
bash-4.3# git checkout 1.7b4
Previous HEAD position was 78bff08... [1.7.x] Bump version number for 1.7 RC 1.
HEAD is now at 95cf172... Bumped version number for release.
bash-4.3# cd /sites/test_dj
bash-4.3# python -c "import django; print(django.get_version())"
1.7b4
bash-4.3# ./django-admin.py startproject myproject
bash-4.3#
comment:4 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
I think the problem is you are mixing versions of Django between a checkout and the system-wide install. It appears you have checked out Django in /usr/src/devel/django. But then, the traceback shows that the executed code is in /usr/lib64/python2.7/site-packages/django/.
I would suggest that you remove the system-wide django package and work with virtualenvs instead.
comment:5 by , 10 years ago
Resolution: | invalid |
---|---|
Status: | closed → new |
Hmm..sorry, but I not mixing versions of django, 'cause only have symbolic link from /usr/src/devel/django to /usr/lib64/python2.7/site-packages/django/
I check now with virtualenv- and not problem with django-admin.
But without virtualenv with system-wide install - i have problem as write earlier.
Don't know how it's critically, but in 1.7b4 not problem, in later versions - exist.
Please check without virtialenv.
comment:6 by , 10 years ago
I just tried with master, installing it system-wide, but was not able to reproduce your issue. I'm out of ideas.
comment:7 by , 10 years ago
anonymous, if you can bisect to the commit where the behavior changed in might help.
comment:8 by , 10 years ago
Problem exist after commit 4865326f2200aa1c480526feef5428cf780ab3c6
commit 4865326f2200aa1c480526feef5428cf780ab3c6
Author: Aymeric Augustin <aymeric.augustin@…>
Date: Tue May 27 18:57:53 2014 +0200
example:
bash-4.3# git checkout 4865326f2200aa1c480526feef5428cf780ab3c6
HEAD is now at 4865326... Fixed #22699 -- Configure default settings in some management commands.
bash-4.3#
bash-4.3# ./django-admin.py
Traceback (most recent call last):
File "./django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/usr/lib64/python2.7/site-packages/django/core/management/init.py", line 432, in execute_from_command_line
utility.execute()
File "/usr/lib64/python2.7/site-packages/django/core/management/init.py", line 401, in execute
django.setup()
File "/usr/lib64/python2.7/site-packages/django/init.py", line 20, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/usr/lib64/python2.7/site-packages/django/django/conf/init.py", line 46, in getattr
self._setup(name)
File "/usr/lib64/python2.7/site-packages/django/django/conf/init.py", line 40, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Previous commit- all normal.
commit 2e613ea5c52d4d12e071987178af18c0371d6e2f
Author: Moayad Mardini <moayad.m@…>
Date: Mon May 26 23:09:17 2014 +0300
Example:
bash-4.3#
bash-4.3# git checkout 2e613ea5c52d4d12e071987178af18c0371d6e2f
Previous HEAD position was 4865326... Fixed #22699 -- Configure default settings in some management commands.
HEAD is now at 2e613ea... Fixed #22675 -- makemigrations --dry-run to output migrations to stdout.
bash-4.3#
bash-4.3# ./django-admin.py
Usage: django-admin.py subcommand [options] [args]
Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Raise on exception
--no-color Don't colorize the command output.
--version show program's version number and exit
-h, --help show this help message and exit
Type 'django-admin.py help <subcommand>' for help on a specific subcommand.
Available subcommands:
[django]
check
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
makemigrations
migrate
runfcgi
runserver
shell
sql
sqlall
sqlclear
sqlcustom
sqldropindexes
sqlflush
sqlindexes
sqlmigrate
sqlsequencereset
squashmigrations
startapp
startproject
syncdb
test
testserver
validate
Note that only Django core commands are listed as settings are not properly configured (error: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.).
bash-4.3#
Thank you very much for your job. Django is great software.
comment:9 by , 10 years ago
Owner: | changed from | to
---|---|
Severity: | Normal → Release blocker |
Status: | new → assigned |
I shall look into this.
comment:10 by , 10 years ago
Have we established if this is a problem in 1.7c1 or not? Need to know if it's a 1.7 release blocker.
comment:11 by , 10 years ago
Version: | master → 1.7-rc-1 |
---|
Yes, the referenced commit was backported to stable/1.7.x.
@anonymous, are there any contents in /sites/test_dj
The fact that you run ./django-admin.py
seems to suggest its existence there? Normally django-admin.py
is added to your PATH when you install Django so you omit ./
.
I tried
$ cd ~/code/django/django/bin $ ./django-admin.py
but still didn't reproduce the error.
comment:12 by , 10 years ago
No. In /sites/test_dj i don't have any contents, only symlink to django-admin.py
But I confirm, then in virtualenv not have problem.
Now try in standard place of django-admin.py in django tree. Same situation
You may see output.
bash-4.3# ls
django-2to3.py django-admin.py profiling unique-messages.py
bash-4.3# git checkout master
Already on 'master'
bash-4.3# ./django-admin.py
Traceback (most recent call last):
File "./django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/usr/lib64/python2.7/site-packages/django/core/management/init.py", line 330, in execute_from_command_line
utility.execute()
File "/usr/lib64/python2.7/site-packages/django/core/management/init.py", line 304, in execute
django.setup()
File "/usr/lib64/python2.7/site-packages/django/init.py", line 20, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/usr/lib64/python2.7/site-packages/django/django/conf/init.py", line 46, in getattr
self._setup(name)
File "/usr/lib64/python2.7/site-packages/django/django/conf/init.py", line 40, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
bash-4.3# git checkout 2e613ea5c52d4d12e071987178af18c0371d6e2f
Note: checking out '2e613ea5c52d4d12e071987178af18c0371d6e2f'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 2e613ea... Fixed #22675 -- makemigrations --dry-run to output migrations to stdout.
bash-4.3# ./django-admin.py
Usage: django-admin.py subcommand [options] [args]
Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Raise on exception
--no-color Don't colorize the command output.
--version show program's version number and exit
-h, --help show this help message and exit
Type 'django-admin.py help <subcommand>' for help on a specific subcommand.
Available subcommands:
[django]
check
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
makemigrations
migrate
runfcgi
runserver
shell
sql
sqlall
sqlclear
sqlcustom
sqldropindexes
sqlflush
sqlindexes
sqlmigrate
sqlsequencereset
squashmigrations
startapp
startproject
syncdb
test
testserver
validate
Note that only Django core commands are listed as settings are not properly configured (error: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.).
bash-4.3#
comment:13 by , 10 years ago
I now remove symlink to django from site-packages, clone repo from git,
python setup.py build install, and all normal ok.
Please close ticket.
May be problem repeat with another user.
comment:14 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
Problem not exist in 1.7b4, but exist in 1.7c1 and master.