Running Django in Virtualenv on EC2 - ImportError: no module named django.core.management

I developed a django application locally in a git repository. I ran an EC2 instance for the project, and I configured virtualenv with (what I think) the correct packages / dependencies. Then I proceeded to clone my repo into a virtual one. I'm having difficulties right now because I am getting the following errors:

I tried to use python manage.py runserver example.com/8080for testing. I was sure that I activated virtualenv using source bin/activate, as in my local virtualenv. When I call ... runserver, I get the following error:

Traceback (most recent call last):
  File "manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
ImportError: No module named django.core.management

Here is what it sudo pip freezeproduces:

Warning: cannot find svn location for distribute==0.6.24dev-r0
Cheetah==2.4.4
Django==1.5.2
Fabric==1.8.0
GnuPGInterface==0.3.2
Landscape-Client==12.05
M2Crypto==0.21.1
PAM==0.4.2
PyYAML==3.10
South==0.8.2
Twisted-Core==11.1.0
Twisted-Names==11.1.0
Twisted-Web==11.1.0
apt-xapian-index==0.44
argparse==1.2.1
boto==2.2.2
chardet==2.0.1
cloud-init==0.6.3
command-not-found==0.2.44
configobj==4.7.2
## FIXME: could not find svn URL in dependency_links for this package:
distribute==0.6.24dev-r0
django-s3-folder-storage==0.1
django-storages==1.1.8
django-tastypie==0.10.0
ecdsa==0.9
euca2ools==2.0.0
gunicorn==18.0
httplib2==0.7.2
keyring==0.9.2
language-selector==0.1
launchpadlib==1.9.12
lazr.restfulclient==0.12.0
lazr.uri==1.0.3
medusa==0.5.4
meld3==0.6.5
oauth==1.0.1
paramiko==1.12.0
psycopg2==2.5.1
pyOpenSSL==0.12
pycrypto==2.4.1
pycurl==7.19.0
pyserial==2.5
python-apt==0.8.3ubuntu7.1
python-dateutil==2.1
python-debian==0.1.21ubuntu1
simplejson==2.3.2
six==1.4.1
supervisor==3.0a8
ufw==0.31.1-1
unattended-upgrades==0.1
virtualenv==1.10.1
wadllib==1.3.0
wsgiref==0.1.2
zope.interface==3.6.1

... and this is my file ./manage.py:

#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my_project.settings")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

, ? #!/usr/bin/env python #!/var/www/paletto-env/bin python, python, , .

.

+4
5

, Django, .

Python ( Django) :

import django
django.VERSION

, , Django. , . Django.

Django, , , . , , , , python virtualenv.

+3

, , ( : , , , ).

:

pip install (package) sudo pip install (package)

:

Django complete install doc (. ), , , pip virtualenv. , , , , , .

, , sudo pip install django, - bin virtualenv . , , python manage.py runserver, ; , sudo python manage.py runserver, .

, sudo pip freeze , pip freeze virtualenv.

sudo (do stuff) , , virtualenv, django, env pip install django django , pip freeze , python manage.py runserver !

+3

django-admin.py startproject shebang manage.py #!/usr/bin/env python.

python, python3, manage.py, .

+1

python angain , virtualenv.

0
source

Django may have lost the pip plugin, so we can install Django with Tarball:

more ... ( fooobar.com/questions/1506798 / ...

0
source

All Articles