Django网站为mixins提供了一个importerror

时间:2017-03-09 15:34:19

标签: python django python-2.7

我已经获得了一组文件(Django网站),我应该在本地盒子和“支持”上进行部署。首先,我不得不说我只有非常基本的Django经验(主要是做教程并自己构建一个简单的应用程序)。其次,文件没有requirements.txt或任何指令,所以我不得不依赖大量的重复试验,这使我能够运行服务器(python manage.py runserver),安装runserver命令崩溃的依赖项后(即bootstrap_themesPillowdbbackup)。但是一旦我尝试访问该网站,我就会收到以下错误:

Environment:


Request Method: GET
Request URL: http://ec2-34-252-71-244.eu-west-1.compute.amazonaws.com:8000/

Django Version: 1.8.7
Python Version: 2.7.12
Installed Applications:
['gts.apps.GtsConfig',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'bootstrap_themes',
 'dbbackup']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']


Traceback:
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  119.                 resolver_match = resolver.resolve(request.path_info)
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py" in resolve
  365.             for pattern in self.url_patterns:
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py" in url_patterns
  401.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py" in urlconf_module
  395.             self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
  37.     __import__(name)
File "/home/ubuntu/glycoenzymes/GlycoEnzymes/glycoenzymesapp/urls.py" in <module>
  22.     url(r'^gts/', include('gts.urls'    )),
File "/usr/lib/python2.7/dist-packages/django/conf/urls/__init__.py" in include
  33.         urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
  37.     __import__(name)
File "/home/ubuntu/glycoenzymes/GlycoEnzymes/gts/urls.py" in <module>
  7. from . import views
File "/home/ubuntu/glycoenzymes/GlycoEnzymes/gts/views.py" in <module>
  6. from django.contrib.auth.mixins import LoginRequiredMixin

Exception Type: ImportError at /
Exception Value: No module named mixins

制作原始文件的编码人员表示,该网站在他的盒子上运行没有任何问题,并且他能够再次安装它而没有任何问题。因此,我的问题是如何找出它在我的盒子上不起作用的原因(考虑到原始编码器没有反应)。具体来说,如果没有settings.txt文件或移交文档,那么有什么好方法可以看到Django项目需要什么。

1 个答案:

答案 0 :(得分:2)

您已安装Django 1.8.7。 auth mixins是added in Django 1.9

安装Django时,应安装最新的版本。例如,您已安装Django 1.8.7,但最新的版本是1.8.17,因此您缺少安全修复程序。如果您决定部署1.9.x,请在发布Django 1.11时注意security support will end in April 2017。 Django 1.8是一个LTS,因此将一直支持到2018年4月。