Very specific stuff. I'm running a Bitnami Django stack cloud VM on Amazon. On two different "regular" machines, I could install requests by running sudo pip install requests, but it seems that Bitname uses it's own specific structure, and something is going wrong when installing requests that way. It can also be related to issue #2028, but it was fixed long time ago.
I have the following traceback:
Environment:
Request Method: GET
Request URL: http://54.94.226.137/
Django Version: 1.7.7
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'vz_base',
'vz_api',
'vz_admin',
'vz_user')
Installed Middleware:
('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 "/opt/bitnami/python/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
98. resolver_match = resolver.resolve(request.path_info)
File "/opt/bitnami/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
343. for pattern in self.url_patterns:
File "/opt/bitnami/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns
372. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/opt/bitnami/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
366. self._urlconf_module = import_module(self.urlconf_name)
File "/opt/bitnami/python/lib/python2.7/importlib/__init__.py" in import_module
37. __import__(name)
File "/opt/bitnami/apps/django/django_projects/ProjetoVigZul/ProjetoVigZul/urls.py" in <module>
5. from vz_api import urls as api_urls
File "/opt/bitnami/apps/django/django_projects/ProjetoVigZul/vz_api/urls.py" in <module>
8. from vz_api import views
File "/opt/bitnami/apps/django/django_projects/ProjetoVigZul/vz_api/views.py" in <module>
14. from vz_api.dguard import DGuardManager, DGuardIntegrationException
File "/opt/bitnami/apps/django/django_projects/ProjetoVigZul/vz_api/dguard.py" in <module>
5. import requests, json
File "/opt/bitnami/python/lib/python2.7/site-packages/requests/__init__.py" in <module>
58. from . import utils
File "/opt/bitnami/python/lib/python2.7/site-packages/requests/utils.py" in <module>
25. from . import certs
Exception Type: ImportError at /
Exception Value: cannot import name certs
Website is live at http://54.94.226.137/, if anyone is interested.
sudo pip install --upgrade requests
solved that for me
Related
Django Version: 1.8 Python Version: 3.5.2
Getting this Error when i'm running this app on production, from Windows to 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..
Please help!
Check your version of django rest framework, the current version (3.7) does not support django 1.8. You need rest_framework 3.6 to run on django 1.8
This appears to be because your ROOT_URLCONF setting in your settings.py file is pointing to a non-existent file. Go to your settings.py file in your project and set it to something like this:
ROOT_URLCONF = 'mydashboard.urls'
I recently updated a project that was working with Django rest framework 2.4.2 to the newly 3.1 version but now I'm getting a:
'module' object has no attribute 'HStoreField'
That happens to all the endpoints including the "/"
Any suggestions?
my Django version is 1.8 and python 2.7.6
Traceback:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.8.dev20140910173004
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest',
'rest_framework',
'geoposition',
'rest_framework_swagger',
'PIL',
'rest_framework.authtoken',
'corsheaders')
Installed Middleware:
('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 "/Users/marcus/PycharmProjects/django-framework/django-trunk/django/core/handlers/base.py" in get_response
112. resolver_match = resolver.resolve(request.path_info)
File "/Users/marcus/PycharmProjects/django-framework/django-trunk/django/core/urlresolvers.py" in resolve
362. for pattern in self.url_patterns:
File "/Users/marcus/PycharmProjects/django-framework/django-trunk/django/core/urlresolvers.py" in url_patterns
398. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Users/marcus/PycharmProjects/django-framework/django-trunk/django/core/urlresolvers.py" in urlconf_module
392. self._urlconf_module = import_module(self.urlconf_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py" in import_module
37. __import__(name)
File "/Users/marcus/Google Drive/Spring2015/AppContest/MyApplication/Backend/Backend/urls.py" in <module>
3. from rest_framework import routers
File "/Library/Python/2.7/site-packages/rest_framework/routers.py" in <module>
23. from rest_framework import views
File "/Library/Python/2.7/site-packages/rest_framework/views.py" in <module>
91. class APIView(View):
File "/Library/Python/2.7/site-packages/rest_framework/views.py" in APIView
94. renderer_classes = api_settings.DEFAULT_RENDERER_CLASSES
File "/Library/Python/2.7/site-packages/rest_framework/settings.py" in __getattr__
206. val = perform_import(val, attr)
File "/Library/Python/2.7/site-packages/rest_framework/settings.py" in perform_import
158. return [import_from_string(item, setting_name) for item in val]
File "/Library/Python/2.7/site-packages/rest_framework/settings.py" in import_from_string
170. module = importlib.import_module(module_path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py" in import_module
37. __import__(name)
File "/Library/Python/2.7/site-packages/rest_framework/renderers.py" in <module>
20. from rest_framework import exceptions, serializers, status, VERSION
File "/Library/Python/2.7/site-packages/rest_framework/serializers.py" in <module>
1354. ModelSerializer.serializer_field_mapping[postgres_fields.HStoreField] = CharMappingField
Exception Type: AttributeError at /
Exception Value: 'module' object has no attribute 'HStoreField'
Installing the latest release candidate of Django 1.8 should fix the issue.
You are running 1.8.dev20140910173004, which already has support for some Postgres fields, but not for HStoreField yet. Django REST framework only checks for the django.contrib.postgres and then assumes that HStoreField is available too. For your version of Django that is not the case.
If pip install -u doesn't get you the latest version, try removing and reinstalling Django.
I'm getting this error:
No module named six
But if go to python and try:
import six
It works.
This is my full traceback:
Environment:
Request Method: GET
Request URL: http://queromaiseducacao.com.br/
Django Version: 1.6.5
Python Version: 2.7.5
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'simulado',
'south',
'multichoice',
'django.contrib.admin',
'social_auth')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback:
File "/home/filipefr2/webapps/quiz/lib/python2.7/django/core/handlers/base.py" in get_response
99. resolver_match = resolver.resolve(request.path_info)
File "/home/filipefr2/webapps/quiz/lib/python2.7/django/core/urlresolvers.py" in resolve
339. sub_match = pattern.resolve(new_path)
File "/home/filipefr2/webapps/quiz/lib/python2.7/django/core/urlresolvers.py" in resolve
223. return ResolverMatch(self.callback, args, kwargs, self.name)
File "/home/filipefr2/webapps/quiz/lib/python2.7/django/core/urlresolvers.py" in callback
230. self._callback = get_callable(self._callback_str)
File "/home/filipefr2/webapps/quiz/lib/python2.7/django/utils/functional.py" in wrapper
32. result = func(*args)
File "/home/filipefr2/webapps/quiz/lib/python2.7/django/core/urlresolvers.py" in get_callable
97. mod = import_module(mod_name)
File "/home/filipefr2/webapps/quiz/lib/python2.7/django/utils/importlib.py" in import_module
40. __import__(name)
File "/home/filipefr2/webapps/quiz/quiz/simulado/views.py" in <module>
17. from pagseguro import Payment
File "/home/filipefr2/lib/python2.7/pagseguro/__init__.py" in <module>
2. from pagseguro.api.v2.payment import Payment as PaymentV2
File "/home/filipefr2/lib/python2.7/pagseguro/api/v2/payment.py" in <module>
10. import dateutil.parser
File "/home/filipefr2/lib/python2.7/dateutil/parser.py" in <module>
24. from six import text_type, binary_type, integer_types
Exception Type: ImportError at /
Exception Value: No module named six
I am new to Django and following the tutorial mentioned in this link:
http://www.djangobook.com/en/2.0/index.html
Everything goes well till I come to the Chapter 3, section of creating the Hello World:
http://www.djangobook.com/en/2.0/chapter03.html
I believe I have followed everything to the letter - but when I try to access the site:
http://127.0.0.1:8000/hello/
I get the following error:
ImportError at /hello/
No module named views
Here is the traceback information for this error:
Environment:
Request Method: GET
Request URL: `http://127.0.0.1:8000/hello/`
Django Version: 1.5.1
Python Version: 2.7.5
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "E:\DPF\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
103. resolver_match = resolver.resolve(request.path_info)
File "E:\DPF\Python27\lib\site-packages\django\core\urlresolvers.py" in resolve
319. for pattern in self.url_patterns:
File "E:\DPF\Python27\lib\site-packages\django\core\urlresolvers.py" in url_patterns
347. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "E:\DPF\Python27\lib\site-packages\django\core\urlresolvers.py" in urlconf_module
342. self._urlconf_module = import_module(self.urlconf_name)
File "E:\DPF\Python27\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name)
File "E:\Work\Documents\Sites\mysite\mysite\urls.py" in <module>
2. from mysite.views import hello
Exception Type: ImportError at /hello/
Exception Value: No module named views
The directory structure is as follows:
mysite--
mysite--
__init__.py
__init__.pyc
settings.py
settings.pyc
urls.py
urls.pyc
wsgi.py
wsgi.pyc
django.db
manage.py
views.py
Any idea what could have gone wrong?
Regards,
Indrajit
did you added <appname> to INSTALLED_APPS in settings.py
still errror then,
if you run django-admin.py startapp <appneam> from the project folder(\<mainfolder>\<projectfolder>)
the you want to try:
from <yourprojectname>.<yourappname>.views import hello
or you run django-admin.py startapp <appneam> from the folder contains manage.py(ie the \<mainfolder>\).
then do all the nessasary steps and then try:
from <yourappname>.views import hello
actually the djangobook is old and not updated frequently.
There is this library that I would like to get familiar with called django-schedule, there is a project sample they say is up and running, the thing is it's not currently updated to django 1.4 but there is a fork with a pull request that updates it https://github.com/Natim/django-schedule
But when running it i get an error that i think is this
(r'^schedule/', include('schedule.urls')),
I installed the with setup.py what do you think i have to do to get this up and running?
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.4.2
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.admindocs',
'schedule')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/core/handlers/base.py" in get_response
89. response = middleware_method(request)
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/middleware/locale.py" in process_request
21. check_path = self.is_language_prefix_patterns_used()
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/middleware/locale.py" in is_language_prefix_patterns_used
54. for url_pattern in get_resolver(None).url_patterns:
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/core/urlresolvers.py" in url_patterns
328. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/core/urlresolvers.py" in urlconf_module
323. self._urlconf_module = import_module(self.urlconf_name)
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/utils/importlib.py" in import_module
35. __import__(name)
File "/home/brian/code/django-schedule/project_sample/../project_sample/urls.py" in <module>
10. (r'^schedule/', include('schedule.urls')),
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/conf/urls/__init__.py" in include
24. urlconf_module = import_module(urlconf_module)
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/utils/importlib.py" in import_module
35. __import__(name)
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/django_schedule-0.5b-py2.7.egg/schedule/urls.py" in <module>
4. from schedule.feeds import UpcomingEventsFeed
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/django_schedule-0.5b-py2.7.egg/schedule/feeds/__init__.py" in <module>
2. from django.contrib.syndication.feeds import FeedDoesNotExist
Exception Type: ImportError at /
Exception Value: No module named feeds
I'm looking at the same problem. I think the issue is that this is deprecated:
from django.contrib.syndication.feeds import FeedDoesNotExist
And should be replaced with:
from django.contrib.syndication.views import FeedDoesNotExist
This got me past the error you report.