I tried to install django db log from here https://github.com/dcramer/django-db-log, by running python setup.py install, but for some reason when I add the app to the settings.py file, it's not working. here's the error that I get:
Request Method: GET
Request URL: http://localhost:8000/admin/
Django Version: 1.3.1
Exception Type: ImportError
Exception Value:
cannot import name Paginator
Exception Location: /Library/Python/2.6/site-packages/django/utils/importlib.py in import_module, line 35
Python Executable: /usr/bin/python
Python Version: 2.6.1
Python Path:
['/Users/christopherfarm/Desktop/ecomstore',
'/Library/Python/2.6/site-packages/python_dateutil-1.5-py2.6.egg',
'/Library/Python/2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg',
'/Library/Python/2.6/site-packages/django_db_log-2.2.1-py2.6.egg',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload',
'/Library/Python/2.6/site-packages',
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC',
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode']
Server time:
From the django-db-log's project page:
This project is no longer updated. Please see http://github.com/dcramer/django-sentry for its successor
So I simply assume that this project is not compatible with Django-1.3.1 due to various deprecations...
Related
I have a problem described in this post I have no idea what is the reason of the problem so I decided to create a new project both in Docker like without it. In both cases I get the same problem. To wit to newly created project I add only to urls.py:
from rest_framework.documentation import include_docs_urls
API_TITLE = 'API title'
API_DESCRIPTION = '...'
urlpatterns = [
url(r'^docs/', include_docs_urls(title=API_TITLE, description=API_DESCRIPTION))
]
and in Docker requirements.txt I add coreapi. In case of project without Docker I install via virtualenv pip3 install coreapi. That is all what in my opinion I should do in order to get a view like at the top of this site from documentation Obviously at http://localhost:8000/docs/ However in both cases I get
TemplateDoesNotExist at /docs/
rest_framework/docs/index.html
Django tried loading these templates, in this order:
Using engine django:
django.template.loaders.app_directories.Loader: /usr/local/lib/python3.6/site-packages/django/contrib/admin/templates/rest_framework/docs/index.html (Source does not exist)
django.template.loaders.app_directories.Loader: /usr/local/lib/python3.6/site-packages/django/contrib/auth/templates/rest_framework/docs/index.html (Source does not exist)
(in virtualenv there is only different path)
Does anyone have an idea what might be wrong? If more details will be needed I will add it immediately to this post, just let me know.
UPDATE
When I add rest_framowork to INSTALLED_APPS I get:
AttributeError at /docs/
'NoneType' object has no attribute 'items'
Request Method: GET
Request URL: http://localhost:8001/docs/
Django Version: 1.11
Exception Type: AttributeError
Exception Value:
'NoneType' object has no attribute 'items'
Exception Location: /usr/local/lib/python3.6/site-packages/rest_framework/templatetags/rest_framework.py in items, line 244
Python Executable: /usr/local/bin/python3
Python Version: 3.6.1
Python Path:
['/code',
'/usr/local/lib/python36.zip',
'/usr/local/lib/python3.6',
'/usr/local/lib/python3.6/lib-dynload',
'/usr/local/lib/python3.6/site-packages']
In template /Users/myUser/Projects/DjangoTest/lib/python3.6/site-packages/rest_framework/templates/rest_framework/docs/sidebar.html, error at line 8
UPDATE2
I have in my app on heroku rest_framowork at the top of INSTALLED_APPS however http://myapp.herokuapp.com/docs/ returns:
AttributeError at /docs/
'NoneType' object has no attribute 'items'
Request Method: GET
Request URL: http://myapp.herokuapp.com/docs/
Django Version: 1.11
Exception Type: AttributeError
Exception Value:
'NoneType' object has no attribute 'items'
Exception Location: /app/.heroku/python/lib/python3.6/site-packages/rest_framework/templatetags/rest_framework.py in items, line 244
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.6.1
Python Path:
['/app/Project/backend/project',
'/app/.heroku/python/bin',
'/app',
'/app/.heroku/python/lib/python36.zip',
'/app/.heroku/python/lib/python3.6',
'/app/.heroku/python/lib/python3.6/lib-dynload',
'/app/.heroku/python/lib/python3.6/site-packages']
Server time: Mon, 17 Jul 2017 12:49:49 +0000
SOLTUION
I used djangorestframework==3.6.2 instead of djangorestframework==3.6.3 in requirements.txt. I have no idea why version 3.6.3 doesn't work.
This likely means that you didn't add rest_framework to the INSTALLED_APPS in the settings.py file.
installed Django 1.6.1 over 1.5, update Pillow, PIL, django-ckeditor and django-ckeditor-updated, remove default from url. When I want to upload a picture I see this:
ImportError at /ckeditor/upload/
No module named image
Request Method: POST
Request URL: mysiteaddress/ckeditor/upload/?CKEditor=id_about&CKEditorFuncNum=1&langCode=en
Django Version: 1.6.1
Exception Type: ImportError
Exception Value:
No module named image
Exception Location: /usr/local/lib/python2.7/site-packages/ckeditor/image_processing.py in get_backend, line 10
Python Executable: /usr/local/bin/uwsgi
Python Version: 2.7.5
someone can help?
Along with trying collect static, you are not supposed to have django-ckeditor and django-ckeditor-updated in the same project. See installation notes.
https://github.com/shaunsephton/django-ckeditor#installation
I get this error when I try to access products or catelogue
I have installed libjpeg-dev and then pil.
I'm running the django_oscar sandbox locally. what should I do ?
Please also specify what additional info should I add ??
IOError at /catalogue/
decoder jpeg not available
Request Method: GET
Request URL: http://127.0.0.1:8888/catalogue/
Django Version: 1.4.6
Exception Type: IOError
Exception Value:
decoder jpeg not available
Exception Location: /home/vagrant/oscar/local/lib/python2.7/site-packages/PIL/Image.py in _getdecoder, line 385
Python Executable: /home/vagrant/oscar/bin/python
Python Version: 2.7.3
Python Path:
['/vagrant/projects/ecommerce/clone/django-oscar/sites/sandbox',
'/home/vagrant/oscar/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg',
'/home/vagrant/oscar/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg',
'/vagrant/projects/ecommerce/clone/django-oscar',
'/home/vagrant/oscar/local/lib/python2.7/site-packages/django_treebeard-2.0b1-py2.7.egg',
'/home/vagrant/oscar/lib/python2.7',
'/home/vagrant/oscar/lib/python2.7/plat-linux2',
'/home/vagrant/oscar/lib/python2.7/lib-tk',
'/home/vagrant/oscar/lib/python2.7/lib-old',
'/home/vagrant/oscar/lib/python2.7/lib-dynload',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk',
'/home/vagrant/oscar/local/lib/python2.7/site-packages',
'/home/vagrant/oscar/local/lib/python2.7/site-packages/PIL']
If you're using ubuntu, there is a lovely blog post by the Oscar author about exactly this :)
http://codeinthehole.com/writing/how-to-install-pil-on-64-bit-ubuntu-1204/
Trying to create simple login functionality using Django, and I'm pretty new to using python and django. I've been searching for a while, but haven't found anything that fixes the problem. I'm running Django using MS VS2010, so I'm working under Windows instead of the typical linux environment. When run, I get this:
Request Method: GET
Request URL: http://localhost:1214/accounts/signup
Django Version: 1.4.3
Exception Type: ImportError
Exception Value:
No module named accounts
Exception Location: C:\Python27\lib\site-packages\django\utils\importlib.py in import_module, line 35
Python Executable: C:\Python27\python.exe
Python Version: 2.7.3
Python Path:
['C:\\Users\\brandon\\Desktop\\AdvancedLogin\\AdvancedLogin',
'C:\\Windows\\system32\\python27.zip',
'C:\\Python27\\DLLs',
'C:\\Python27\\lib',
'C:\\Python27\\lib\\plat-win',
'C:\\Python27\\lib\\lib-tk',
'C:\\Python27',
'C:\\Python27\\lib\\site-packages']
I've got the
__init__.py
file in bot the main project directory, and the app directory, though I haven't modified them at all.
I'm not really sure where to go from here. Any help is appreciated!
Did you add the accounts to your settings.py?
For other people be sure to use the correct AUTHENTICATION_BACKENDS. I've set up one for test but forgot it and i've got the same error.
Before i was :
settings.py
AUTHENTICATION_BACKENDS = (
'accounts.backends.MyAuthBackend',
)
After : settings.py
#Default one
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
)
This same error I was getting when I included 'accounts' in my setting.py file in "INSTALLED_APPS". But I was using sublime editor so I forgot to save that file and got this error.
Simply you have to add this "accounts" this to INSTALLED_APPS. this worked for me.
GAE 1.5.5 looks to have some excellent, long-waited for features. However, they're not working for me yet.
I've downloaded and installed GAE 1.5.5, and am using a degenerate "AAA" app to test.
Here's roughly my app.yaml (with various changes having been made for testing).
app.yaml
application: AAA # mystical creation.
version: alpha-1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /media
static_dir: media/
- url: /favicon.ico
static_files: media/images/favicon.ico
upload: media/images/favicon.ico
- url: /admin
script: AAA.app
login: admin
- url: /.*
script: AAA.app
skip_files:
- ^(.*/)?app\.yaml
libraries:
- name: django
version: "1.2"
- name: jinja2
version: latest
- name: yaml
version: latest
I'm running this on Mac OS X Lion (10.7.1).
I hypothesize that I am not actually using the Python 2.7 runtime, in spite of the declaration in app.yaml to use it. I'm not quite sure how to validate this theory, but the errors I've encountered are consistent with it. These errors are reproduced below.
Python Path
When Google App Engine's Python Path is not set, the app engine runs
using Python 2.6.6.
To fix this I set Python Path to /usr/bin/python2.7 in the Google App
Engine preferences.
WSGI
I get the following error:
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/dev_appserver.py in
GetParentPackage(self=<google.appengine.tools.dev_appserver.HardenedModulesHook
object>, fullname='AAA.app')
2334
2335 if self.find_module(fullname) is None:
=> 2336 raise ImportError('Could not find module %s' %
fullname)
2337
2338 return self._module_dict[parent_module_fullname]
builtin ImportError = <type 'exceptions.ImportError'>, fullname =
'AAA.app'
<type 'exceptions.ImportError'>: Could not find module AAA.app
args = ('Could not find module AAA.app',)
message = 'Could not find module AAA.app'
Where I've tried AAA.app as:
AAA.py:
from google.appengine.dist import use_library
use_library('django', '1.2') # otherwise we still get django 0.96
from django.core.handlers import wsgi
app = wsgi.WSGIHandler()
AAA/__init__.py
# same content as above
AAA/AAA.py
# same content as above
Note that I can continue to run CGI with app.yaml and AAA.py modified,
mutatis mutandis. However doing so nevertheless results in those errors below:
Jinja2
When I run import jinja2 I get an ImportError.
Django2
Without:
from google.appengine.dist import use_library
use_library('django', '1.2')
I end up with Django 0.96.
Theory
Given the following:
http://code.google.com/appengine/docs/python/tools/libraries27.html
states "The use_library() function provided by the
google.appengine.dist package is unavailable in Python 2.7."
use_library works for me
use_library is required because the "libraries: {django: {...,
version: "1.2"}} declaration does not set the django version to 1.2
Only Django 1.2 is included in the Python 2.7 runtime (per the
libraries27.html link above)
I have to manually specify Python 2.7 in the Python Path in order
for GAE to use Python 2.7
WSGI doesn't load the application properly
Jinja2 cannot be imported
I believe I am not really using the Python 2.7 GAE runtime (i.e. the app.yaml declaration is being ignored in the GAE 1.5.5 SDK).
I hope the above is a helpful description, and I'd be grateful for any thoughts as to what may be happening here – and potential solutions.
I'm have the same issue but on Windows, I posted on the Google App Engine forum and here is an official response I got:
The Dev server doesn't support 2.7 yet. Currently the only way to test
2.7 based code is on appengine
You can use the 2.7 runtime with the local SDK, but just not in threadsafe mode, or with your application defined like script: your.app. Instead use script: your_main_script.py.
For jinja2 and webapp2 which aren't available in the SDK, you can download them and place them in the SDK base directory, which is by default added to sys.path.
You won't be able to test the multithreading capabilities, but you can do everything else, and simply make the changes to app.yaml and your_main_script.py before you deploy.
EDIT: Also, I had to do os.environ[u'APPENGINE_RUNTIME'] = u'python27' in my your_main_script.py, to force the SDK to use webapp2.
Allbuttonspressed has recently posted this handy guide;
you can rundev_appserver on Python27 with threadsafe set to yes.