37π
I had the same issue when starting a new project.
I solved the problem by giving this command at the command prompt:
export DJANGO_SETTINGS_MODULE=
in this way I unset the variable that was pointing to a βsettings
β file (discovered using env | grep DJANGO_SETTINGS_MODULE
) I set before starting using virtualenv
after unsetting the variable the django-admin.py
script worked like a charm!
15π
Iβve had the same issue as you, and I havenβt come up with a good fix aside from prepending my project folder to the PYTHONPATH like this:
export PYTHONPATH="/absolute/path/to/django/project/folder:$PYTHONPATH"
where my <project>
is located at /absolute/path/to/django/project/folder/<project>
. I add that export
command to the end of my env/bin/activate
script so it happens every time I initialize the virtualenv.
The only difference between our two situations is that I use multiple settings files instead of a single settings.py
module.
You can also call django-admin.py
from the folder containing your Django project like so:
python ~/.virtualenvs/devel/bin/django-admin.py <command>
so that it recognizes your current working directory as part of the path.
Hope that makes sense. Itβs kind of clumsy to explain which makes it hard to search for an answer.
- [Django]-With DEBUG=False, how can I log django exceptions to a log file
- [Django]-Problems extend change_form.html in django admin
- [Django]-Nginx doesn't serve static
1π
Maybe your problem is related to this:
Wrong python path in script header
If you want to do anything except creating a new django project inside your venv, you should call python manage.py
(of course, whereis python
should return your venv executable)
- [Django]-Django rest framework: query parameters in detail_route
- [Django]-ForeignKey to abstract class (generic relations)
- [Django]-A field with precision 10, scale 2 must round to an absolute value less than 10^8
0π
Donβt run the script from the direct path to the django library; run it from any other path. It seems you cd
into the directory where django is installed (or where you downloaded and expanded it) and then ran the command from there.
So try this:
(devel)ninja Django-1.5b1: cd
(devel)ninja: django-admin.py startproject foo
- [Django]-Naming convention for Django URL, templates, models and views
- [Django]-How can i test for an empty queryset in Django?
- [Django]-Django gunicorn sock file not created by wsgi
-2π
Are you sure you are starting the django-admin from the virtualenv django instalation ? Perhaps path/to/virtualenv/bin/django-admin.py
- [Django]-Difference between User.objects.create_user() vs User.objects.create() vs User().save() in django
- [Django]-How to make an auto-filled and auto-incrementing field in django admin
- [Django]-Django Multiple Authentication Backend for one project