[英]Trying to deploy an app in Production getting this No module named 'django.urls' error
Django Version: 1.8 Python Version: 3.5.2 Django 版本:1.8 Python 版本:3.5.2
Getting this Error when i'm running this app on production, from Windows to Linux PC当我在生产环境中运行此应用程序时出现此错误,从 Windows 到 Linux PC
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'dasboard')
Traceback:
File "/home/ubuntu/var/www/django_env/lib/python3.5/site-packages/django/core/handlers/base.py" in get_response
119. resolver_match = resolver.resolve(request.path_info)
File "/home/ubuntu/var/www/django_env/lib/python3.5/site-packages/django/core/urlresolvers.py" in resolve
366. for pattern in self.url_patterns:
File "/home/ubuntu/var/www/django_env/lib/python3.5/site-packages/django/core/urlresolvers.py" in url_patterns
402. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/ubuntu/var/www/django_env/lib/python3.5/site-packages/django/core/urlresolvers.py" in urlconf_module
396. self._urlconf_module = import_module(self.urlconf_name)
File "/home/ubuntu/var/www/django_env/lib/python3.5/importlib/__init__.py" in import_module
126. return _bootstrap._gcd_import(name[level:], package, level)
File "/home/ubuntu/var/www/mydashboard/mydashboard/urls.py" in <module>
3. from dasboard import views
File "/home/ubuntu/var/www/mydashboard/dasboard/views.py" in <module>
6. from rest_framework.response import Response
File "/home/ubuntu/var/www/django_env/lib/python3.5/site-packages/rest_framework/response.py" in <module>
13. from rest_framework.serializers import Serializer
File "/home/ubuntu/var/www/django_env/lib/python3.5/site-packages/rest_framework/serializers.py" in <module>
30. from rest_framework.compat import postgres_fields, unicode_to_repr
File "/home/ubuntu/var/www/django_env/lib/python3.5/site-packages/rest_framework/compat.py" in <module>
26. from django.urls import ( **# noqa**
Exception Type: ImportError at /
Exception Value: No module named 'django.urls'
I am not using Postgres simple sqlite db..我没有使用 Postgres 简单的 sqlite db ..
Please help!请帮忙!
Check your version of django rest framework, the current version (3.7) does not support django 1.8.检查您的 django rest 框架版本,当前版本(3.7)不支持 django 1.8。 You need rest_framework 3.6 to run on django 1.8您需要 rest_framework 3.6 才能在 django 1.8 上运行
This appears to be because your ROOT_URLCONF setting in your settings.py file is pointing to a non-existent file.这似乎是因为 settings.py 文件中的 ROOT_URLCONF 设置指向一个不存在的文件。 Go to your settings.py file in your project and set it to something like this:转到项目中的 settings.py 文件并将其设置为如下所示:
ROOT_URLCONF = 'mydashboard.urls'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.