我正在将Python Django项目从一台服务器移动到另一台服务器。我使用的是Debian 7,它在目标服务器上安装了Python 2.7.3(原始服务器也在使用Debian 7)。当我运行manage.py时,如何解决这些错误
我尝试移动的项目有以下目录中它的父文件夹: -
-env
-src
它也有一个文件
install.pip
的应用程序是在新的Web服务器上运行,现在我已经配置了uwsgi,但是我想从项目源文件夹中使用manage.py。当我运行以下命令:
python manage.py changepassword user
我收到以下错误
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ImportError: No module named django.core.management
要尝试解决这个问题,我安装的virtualenv和点子并建立一个新的虚拟environement。然后,我跑到下面的命令:
pip install -r /sourcefolder/install.pip
当我这样做,我收到一个错误
Failed building wheel for Pillow
我研究这个网上,并确定可能的解决办法是安装libjpg,我做到了与以下命令
apt-get install libjpeg8-dev
然后我又跑了pip install -r /sourcefolder/install.pip
这一次,它完成没有任何错误。
我试图再次运行该命令: -
python manage.py changepassword user
和我仍然得到一个错误,但现在它已经改变了。
如果我在虚拟环境之外运行的命令,我收到以下错误:
文件“manage.py”,8号线,从django.core.management 进口execute_from_command_line 导入错误:没有名为django.core.management的模块
如果我从虚拟环境中运行命令(我使用安装时运行了pip。PIP要求)我收到此错误
我已经改变了长期路径/源路径为便于阅读等: -
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
然而,更多的研究网上已经确定这可能是由于缺少DAL包,我应该能够与安装: -
pip install dal
然而,当我运行该命令我收到以下错误
(路径的第一部分省略)
/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
我的研究一直无法找到这个最新的错误的任何解决方案。我开始认为我的方法是错误的,因为我似乎陷入了一个日益增加的错误。
我只是想将django项目从一台服务器移动到另一台服务器,并从源文件夹中执行manage.py而没有任何错误。 (我是系统管理员而不是django编码器,所以希望我错过了一个简单的解决方案)任何帮助,非常感谢。
谢谢!你是一个绅士和学者。我已经安装了它,现在它正在工作。非常感激。 – Gary