I am moving a Python Django project from one server to another server. I am using Debian 7, which has python 2.7.3 installed as standard on the target server (the original server was also using Debian 7).
The project I am trying to move has the following directories in it's parent folder: -
-env
-src
it also has a file
install.pip
The apps are running on the new webserver, now that I have configured uwsgi, but I would like to use manage.py from the project source folder. When I run the following command:
python manage.py changepassword user
I get the following error
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ImportError: No module named django.core.management
To try to resolve this, I installed virtualenv, and pip and built a new virtual environement. I then ran the following command:
pip install -r /sourcefolder/install.pip
When I did this I received an error
Failed building wheel for Pillow
I researched this online and determined a possible solution would be to install libjpg, which i did with the following command
apt-get install libjpeg8-dev
I then ran the pip install -r /sourcefolder/install.pip
again and this time it completed without any errors.
I have tried to run the command once again: -
python manage.py changepassword user
and I am still getting an error, but now it has changed.
If I run the command outside of the virtual environment, I receive the following error:
File "manage.py", line 8, in from django.core.management import execute_from_command_line ImportError: No module named django.core.management
If I run the command from inside the virtual environemnt, (which i have ran pip inside using the install.pip requirements) I receive this error
I have changed long paths to /sourcepath for ease of reading etc: -
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/sourcepath/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/sourcepath/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 324, in execute
django.setup()
File "/sourcepath/env/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/sourcepath/env/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/sourcepath/env/local/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named dal
Yet more research online has determined this is likely due missing a dal package, that I should be able to install with: -
pip install dal
However when I run that command I receive the following error
(first part of path omitted)
/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Could not find a version that satisfies the requirement dal (from versions: )
No matching distribution found for dal
My research has been unable to find any solutions to this latest error. I am starting to think my approach is wrong, as I seem to be falling into a pit of ever increasing errors here.
I simply want to move a django project from one server to another, and execute manage.py from the source folder without any errors. (I am a system admin not a django coder so hope I'm missing an easy solution) any help is much appreciated.
dal
means django-autocomplete-light. May be someone forgot to include this package in requirements. You can also check your INSTALLED_APPS to see if it is actually needed.
To install it with pip you should execute pip install django-autocomplete-light
. Hope it helps.