I can't seem to figure out why I started to get the server error listed all of a sudden. Any ideas?
The full traceback:
Traceback (most recent call last):
File "C:\Python27\lib\wsgiref\handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "C:\Python27\lib\site-packages\django\core\handlers\wsgi.py", line 241, in __call__
response = self.get_response(request)
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 179, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 221, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "C:\Python27\lib\site-packages\django\views\debug.py", line 66, in technical_500_response
html = reporter.get_traceback_html()
File "C:\Python27\lib\site-packages\django\views\debug.py", line 286, in get_traceback_html
c = Context(self.get_traceback_data())
File "C:\Python27\lib\site-packages\django\views\debug.py", line 244, in get_traceback_data
frames = self.get_traceback_frames()
File "C:\Python27\lib\site-packages\django\views\debug.py", line 390, in get_traceback_frames
pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader,
module_name)
File "C:\Python27\lib\site-packages\django\views\debug.py", line 371, in _get_lines_from_file
context_line = source[lineno].strip('\n')
IndexError: list index out of range
[01/Nov/2012 10:46:55] "GET /home HTTP/1.1" 500 59
Traceback (most recent call last):
File "C:\Python27\lib\wsgiref\handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "C:\Python27\lib\site-packages\django\core\handlers\wsgi.py", line 241, in __call__
response = self.get_response(request)
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 179, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 221, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "C:\Python27\lib\site-packages\django\views\debug.py", line 66, in technical_500_response
html = reporter.get_traceback_html()
File "C:\Python27\lib\site-packages\django\views\debug.py", line 286, in get_traceback_html
c = Context(self.get_traceback_data())
File "C:\Python27\lib\site-packages\django\views\debug.py", line 244, in get_traceback_data
frames = self.get_traceback_frames()
File "C:\Python27\lib\site-packages\django\views\debug.py", line 390, in get_traceback_frames
pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader,
module_name)
File "C:\Python27\lib\site-packages\django\views\debug.py", line 371, in _get_lines_from_file
context_line = source[lineno].strip('\n')
IndexError: list index out of range
I can't tell if you are using a webserver of any kind, or just the development server. In any case, shutdown any server you are using, and clean up all of the .pyc files in your project. Restart the webserver, and you should be good to go.
Most commonly there is a mismatch between the compiled files and the sources. As to why this happens, no clue, but it has happened to me in the past: doing the above resolved it for me.
So I finally got it figured out... I set debug = False, just to see what would happen because the traceback included debug.py. Anyway, I'm still a beginner, and don't even know if this really even makes sense, but after I changed debug = False in my settings, I got a new traceback which informed me that one of my CHOICES in one of my forms didn't match. I don't understand at all why this would crash the development server, but I fixed it and now it works. So to clarify what the problem was:
#forms.py
PAYMENT_PLAN = {
('A', 'A'),
('B', 'B'),
('C', 'C'),
}
class SurveyForm(ModelForm):
class Meta:
model = Survey
widgets = {
'pay_plan': Select(choices=PAY_PLAN),
...
}
So, the new traceback with debug=False stated:
NameError: name 'PAY_PLAN' is not defined
So anyway, I fixed that, and now it works again. So if someone runs into the same issue, try turning debug=False to see what happens and maybe it will help you figure it out.
Related
all modules has been installed correctly since I restored it from a working backup.
the problem is, it doesn't read properly. does anyone know how to fix this?
2022-02-15 02:40:22,799 31154 ERROR tester werkzeug: Error on request:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 205, in run_wsgi
execute(self.server.app)
File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 193, in execute
application_iter = app(environ, start_response)
File "/home/ria/olive/tigernixerp11/odoo/service/server.py", line 292, in app
return self.app(e, s)
File "/home/ria/olive/tigernixerp11/odoo/service/wsgi_server.py", line 166, in application
return application_unproxied(environ, start_response)
File "/home/ria/olive/tigernixerp11/odoo/service/wsgi_server.py", line 154, in application_unproxied
result = handler(environ, start_response)
File "/home/ria/olive/tigernixerp11/odoo/http.py", line 1321, in __call__
return self.dispatch(environ, start_response)
File "/home/ria/olive/tigernixerp11/odoo/http.py", line 1295, in __call__
return self.app(environ, start_wrapped)
File "/usr/local/lib/python3.6/dist-packages/werkzeug/wsgi.py", line 599, in __call__
return self.app(environ, start_response)
File "/home/ria/olive/tigernixerp11/odoo/http.py", line 1510, in dispatch
result = ir_http._dispatch()
File "/home/ria/olive/tigernixerp11/addons/auth_signup/models/ir_http.py", line 19, in _dispatch
return super(Http, cls)._dispatch()
File "/home/ria/olive/tigernixerp11/addons/web_editor/models/ir_http.py", line 22, in _dispatch
return super(IrHttp, cls)._dispatch()
File "/home/ria/olive/tigernixerp11/addons/http_routing/models/ir_http.py", line 322, in _dispatch
rule, arguments = cls._find_handler(return_rule=True)
File "/home/ria/olive/tigernixerp11/odoo/addons/base/ir/ir_http.py", line 84, in _find_handler
return cls.routing_map().bind_to_environ(request.httprequest.environ).match(return_rule=return_rule)
File "/home/ria/olive/tigernixerp11/odoo/addons/base/ir/ir_http.py", line 238, in routing_map
cls._routing_map = http.routing_map(mods, False, converters=cls._get_converters())
File "/home/ria/olive/tigernixerp11/odoo/http.py", line 988, in routing_map
routing_map.add(werkzeug.routing.Rule(url, endpoint=endpoint, methods=routing['methods'], **kw))
File "/usr/local/lib/python3.6/dist-packages/werkzeug/routing.py", line 1197, in add
rule.bind(self)
File "/usr/local/lib/python3.6/dist-packages/werkzeug/routing.py", line 681, in bind
self.compile()
File "/usr/local/lib/python3.6/dist-packages/werkzeug/routing.py", line 731, in compile
_build_regex(self.is_leaf and self.rule or self.rule.rstrip('/'))
File "/usr/local/lib/python3.6/dist-packages/werkzeug/routing.py", line 721, in _build_regex
variable, converter, c_args, c_kwargs)
File "/usr/local/lib/python3.6/dist-packages/werkzeug/routing.py", line 689, in get_converter
raise LookupError('the converter %r does not exist' % converter_name)
LookupError: the converter 'str' does not exist
restoring in another computer doesn't seem to have any problem butthis computer seems to be unable to read properly
I am using Flask-KVSession (version 0.6.2). It does what it has to do. But when there are consecutive requests to webserver, following exception is repeated like a flood.
2016-06-10_05:41:58.97125 2016-06-10 05:41:58 [29567] [ERROR] Error handling request
2016-06-10_05:41:58.97127 Traceback (most recent call last):
2016-06-10_05:41:58.97128 File "/usr/lib/pymodules/python2.7/gunicorn/workers/async.py", line 45, in handle
2016-06-10_05:41:58.97128 self.handle_request(listener, req, client, addr)
2016-06-10_05:41:58.97129 File "/usr/lib/pymodules/python2.7/gunicorn/workers/ggevent.py", line 151, in handle_request
2016-06-10_05:41:58.97129 super(GeventWorker, self).handle_request(*args)
2016-06-10_05:41:58.97129 File "/usr/lib/pymodules/python2.7/gunicorn/workers/async.py", line 93, in handle_request
2016-06-10_05:41:58.97130 respiter = self.wsgi(environ, resp.start_response)
2016-06-10_05:41:58.97130 File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
2016-06-10_05:41:58.97140 return self.wsgi_app(environ, start_response)
2016-06-10_05:41:58.97141 File "<flask_app_deploy_file.py>", line 18, in __call__
2016-06-10_05:41:58.97142 File "/usr/lib/python2.7/dist-packages/werkzeug/contrib/fixers.py", line 144, in __call__
2016-06-10_05:41:58.97142 return self.app(environ, start_response)
2016-06-10_05:41:58.97142 File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1813, in wsgi_app
2016-06-10_05:41:58.97143 ctx.push()
2016-06-10_05:41:58.97143 File "/usr/lib/python2.7/dist-packages/flask/ctx.py", line 321, in push
2016-06-10_05:41:58.97152 self.session = self.app.open_session(self.request)
2016-06-10_05:41:58.97161 File "/usr/lib/python2.7/dist-packages/flask/app.py", line 825, in open_session
2016-06-10_05:41:58.97162 return self.session_interface.open_session(self, request)
2016-06-10_05:41:58.97162 File "/usr/lib/pymodules/python2.7/flask_kvsession/__init__.py", line 159, in open_session
2016-06-10_05:41:58.97163 current_app.kvsession_store.get(sid_s)
2016-06-10_05:41:58.97163 EOFError
2016-06-10_05:41:58.97187 ERROR: Error handling request
What can be the cause for the EOFError?
I tried looking into the source code of flask_kvsession, couldn't figure out the exact problem. How that EOFError can be mitigated? Please help me out.
So I have a Django project that doesn't use a database (the 'DATABASES' setting is commented out). I chose to use Django as there's a chance I will need the database functionality in the future. Anyway, I've been working on and off of tbhis project for a couple of months with no problems. I'm running Linux Mint and have had no troubles using the python manage.py runserver command so far.
Well, today I fired up the app and started the local server with no problems. I then tried to open the app in my browser and received the rather hideous error message:
Traceback (most recent call last):
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/sessions/backends/base.py", line 170, in _get_session
return self._session_cache
AttributeError: 'SessionStore' object has no attribute '_session_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/core/handlers/base.py", line 87, in get_response
response = middleware_method(request)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/auth/middleware.py", line 34, in process_request
if user and hasattr(user, 'get_session_auth_hash'):
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/utils/functional.py", line 224, in inner
self._setup()
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/utils/functional.py", line 357, in _setup
self._wrapped = self._setupfunc()
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/auth/middleware.py", line 23, in <lambda>
request.user = SimpleLazyObject(lambda: get_user(request))
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/auth/middleware.py", line 11, in get_user
request._cached_user = auth.get_user(request)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/auth/__init__.py", line 151, in get_user
user_id = request.session[SESSION_KEY]
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/sessions/backends/base.py", line 49, in __getitem__
return self._session[key]
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/sessions/backends/base.py", line 175, in _get_session
self._session_cache = self.load()
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/sessions/backends/db.py", line 21, in load
expire_date__gt=timezone.now()
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/manager.py", line 92, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/query.py", line 351, in get
num = len(clone)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/query.py", line 122, in __len__
self._fetch_all()
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/query.py", line 966, in _fetch_all
self._result_cache = list(self.iterator())
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/query.py", line 265, in iterator
for row in compiler.results_iter():
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/sql/compiler.py", line 700, in results_iter
for rows in self.execute_sql(MULTI):
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/sql/compiler.py", line 775, in execute_sql
sql, params = self.as_sql()
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/sql/compiler.py", line 100, in as_sql
out_cols, s_params = self.get_columns(with_col_aliases)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/sql/compiler.py", line 246, in get_columns
col_aliases)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/sql/compiler.py", line 328, in get_default_columns
r = '%s.%s' % (qn(alias), qn2(column))
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/sql/compiler.py", line 62, in __call__
r = self.connection.ops.quote_name(name)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/backends/dummy/base.py", line 18, in complain
raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/sessions/backends/base.py", line 170, in _get_session
return self._session_cache
AttributeError: 'SessionStore' object has no attribute '_session_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.3/wsgiref/handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/staticfiles/handlers.py", line 64, in __call__
return self.application(environ, start_response)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/core/handlers/wsgi.py", line 187, in __call__
response = self.get_response(request)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/core/handlers/base.py", line 199, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/core/handlers/base.py", line 236, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/views/debug.py", line 91, in technical_500_response
html = reporter.get_traceback_html()
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/views/debug.py", line 349, in get_traceback_html
c = Context(self.get_traceback_data(), use_l10n=False)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/views/debug.py", line 307, in get_traceback_data
frames = self.get_traceback_frames()
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/views/debug.py", line 465, in get_traceback_frames
'vars': self.filter.get_traceback_frame_variables(self.request, tb.tb_frame),
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/views/debug.py", line 232, in get_traceback_frame_variables
cleansed[name] = self.cleanse_special_types(request, value)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/views/debug.py", line 187, in cleanse_special_types
if isinstance(value, HttpRequest):
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/utils/functional.py", line 224, in inner
self._setup()
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/utils/functional.py", line 357, in _setup
self._wrapped = self._setupfunc()
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/auth/middleware.py", line 23, in <lambda>
request.user = SimpleLazyObject(lambda: get_user(request))
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/auth/middleware.py", line 11, in get_user
request._cached_user = auth.get_user(request)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/auth/__init__.py", line 151, in get_user
user_id = request.session[SESSION_KEY]
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/sessions/backends/base.py", line 49, in __getitem__
return self._session[key]
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/sessions/backends/base.py", line 175, in _get_session
self._session_cache = self.load()
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/contrib/sessions/backends/db.py", line 21, in load
expire_date__gt=timezone.now()
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/manager.py", line 92, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/query.py", line 351, in get
num = len(clone)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/query.py", line 122, in __len__
self._fetch_all()
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/query.py", line 966, in _fetch_all
self._result_cache = list(self.iterator())
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/query.py", line 265, in iterator
for row in compiler.results_iter():
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/sql/compiler.py", line 700, in results_iter
for rows in self.execute_sql(MULTI):
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/sql/compiler.py", line 775, in execute_sql
sql, params = self.as_sql()
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/sql/compiler.py", line 100, in as_sql
out_cols, s_params = self.get_columns(with_col_aliases)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/sql/compiler.py", line 246, in get_columns
col_aliases)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/sql/compiler.py", line 328, in get_default_columns
r = '%s.%s' % (qn(alias), qn2(column))
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/models/sql/compiler.py", line 62, in __call__
r = self.connection.ops.quote_name(name)
File "/home/peter/.virtualenvs/vis_it/lib/python3.3/site-packages/django/db/backends/dummy/base.py", line 18, in complain
raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
[28/Nov/2014 13:18:54] "GET / HTTP/1.1" 500 59
I've not touched the app since I last worked on it and it was working fine then. I really have no idea what this is talking about as I have no caches implemented and am not using a database... I've asked a few colleges who are familiar with Django and have no idea what this is either. Any Ideas? I've also tried setting DATABASES to an empty dict {} on the advice of a post online but to no effect. At a bit of a loss.
EDIT: Thought I should mention that in the interim since I last touched this project, I've since started and set up a new Django project that does use a database. Is it possible that this project is somehow cached and breaking the one I'm currently trying to work on?
EDIT2: I should point out that this webapp is currently live and working at http://mrcagney-maps.com. The code is exactly the same (having not touched it since I last pushed to the server). Really weird.
For future Googlers - I ran into this issue and the above solutions did not work for me. What did work for me was clearing/deleting my cookies in Chrome for the 127.0.0.1 URL. So go to Settings or press CMD+, then Cookies and other site data, then find 127.0.0.1 or localhost and delete those cookies. Refresh the local dev host page and the error should be gone. This has something to do with a corrupted session / cookie file.
I'm not sure why I started to get this error, it involved an upgrade though. I just deleted all the sessions and after logging back in all was well.
# from the shell but equivalent sql would work fine too
from django.contrib.sessions.models import Session
Session.objects.all().delete()
The error AttributeError: 'SessionStore' object has no attribute '_session_cache' can stem from the database not having a django_session table. However, since you are not using a table, you would need to make sure that you don't have the 'django.contrib.sessions.middleware.SessionMiddleware' in your MIDDLEWARE_CLASSES in the project's settings file. If it is in there, it will look for a database table which stores the sessions, causing the above error.
Here is what worked for me. Since there is no databases in your application. Admin page looks for the database be it default. So first lets create the default databases.
Shut down your servers and run
python manage.py makemigrations
python manage.py migrate
Now create the admin or superuser for your application. Fill username and password.
python manage.py createsuperuser
Now restart your server and go the admin page
python manage.py runserver
Throwed the same error for me after upgraded my wagtail version... So, for me worked even simpler solution or u didn't noticed already :D Actually I opened the browser > F12 > Storage Tab and Delete all Cookies and all other Cached Data
Users facing this issue via Postman please make sure that the value in the request header for Cache-Control is no-cache.
If not then clear the cookie data for the domain.
In normal case when we use
from django.http import JsonResponse
for sending response we have no need to uses sessions.
But when we use some package such as djangorestframework we force to use sessions.
Sessions need storage place in sqllite,mysql ,...or others
then we need run these commands:
python manage.py makemigrations
python manage.py migrate
I am installing a python project from github (https://github.com/sunlightlabs/publicmarkup) and I get this error message :
File "/usr/local/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 283, in run
self.result = application(self.environ, self.start_response)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 68, in __call__
return self.application(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 273, in __call__
response = self.get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 169, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 214, in handle_uncaught_exception
if resolver.urlconf_module is None:
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 274, in _get_urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/mbenchoufi/git/publicmarkup/../publicmarkup/urls.py", line 5, in <module>
add_to_builtins('mediasync/templatetags/media')
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 1016, in add_to_builtins
builtins.append(import_library(module))
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 951, in import_library
app_path, taglib = taglib_module.rsplit('.',1)
ValueError: need more than 1 value to unpack
I am a newbie to python, what does this error message means ?
The add_to_builtins call in publicmarkup/urls.py is incorrect, it should probably be:
add_to_builtins('mediasync.templatetags.media')
Python packages are dot-delimited and the author used a path instead.
Later on, the Django framework tries to load the module, and splitting off the last name after the last dot fails as there are no dots in the original call.
It looks like the project you are trying to load is fundamentally broken. It probably will have other errors as well.
I have post here about which I learned later that gae has moved here.
Basically I tried django-nonrel example, replacing its django with django-1.3.1 since I coded my app on it but it gives some basic error like cannot find django.db.utils. Note that I have created symbolic link from django -> Django-1.3.1/django and hope its not the issue.
Bases upon replies if I try to use django-nonrel version in my app similar to sample app I get error as below as if its cannot find sqlite3 backend though it mentions as one option in its choices. Also again utils.py is not found.
--> --> -->
Traceback (most recent call last):
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 4143, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 4049, in _Dispatch
base_env_dict=env_dict)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 616, in Dispatch
base_env_dict=base_env_dict)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3120, in Dispatch
self._module_dict)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3024, in ExecuteCGI
reset_modules = exec_script(handler_path, cgi_path, hook)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2887, in ExecuteOrImportScript
exec module_code in script_module.__dict__
File "I:\learn\python\event\djangoappengine\main\main.py", line 97, in <module>
main()
File "I:\learn\python\event\djangoappengine\main\main.py", line 56, in real_main
run_wsgi_app(application)
File "c:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py", line 98, in run_wsgi_app
run_bare_wsgi_app(add_wsgi_middleware(application))
File "c:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py", line 116, in run_bare_wsgi_app
result = application(env, _start_response)
File "I:\learn\python\event\django\core\handlers\wsgi.py", line 265, in __call__
response = self.get_response(request)
File "I:\learn\python\event\django\core\handlers\base.py", line 160, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "I:\learn\python\event\django\core\handlers\base.py", line 194, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "I:\learn\python\event\django\views\debug.py", line 58, in technical_500_response
html = reporter.get_traceback_html()
File "I:\learn\python\event\django\views\debug.py", line 109, in get_traceback_html
frames = self.get_traceback_frames()
File "I:\learn\python\event\django\views\debug.py", line 228, in get_traceback_frames
pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name)
File "I:\learn\python\event\django\views\debug.py", line 180, in _get_lines_from_file
source = loader.get_source(module_name)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2518, in get_source
full_path, search_path, submodule = self.GetModuleInfo(fullname)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2482, in GetModuleInfo
submodule, search_path = self.GetParentSearchPath(fullname)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2461, in GetParentSearchPath
parent_package = self.GetParentPackage(fullname)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2437, in GetParentPackage
if self.find_module(fullname) is None:
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2045, in find_module
search_path)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2375, in FindAndLoadModule
description)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2318, in LoadModuleRestricted
description)
File "I:\learn\python\event\django\db\__init__.py", line 77, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "I:\learn\python\event\django\db\utils.py", line 91, in __getitem__
backend = load_backend(db['ENGINE'])
File "I:\learn\python\event\django\db\utils.py", line 49, in load_backend
raise ImproperlyConfigured(error_msg)
ImproperlyConfigured: 'django.db.backends.sqlite3' isn't an available database backend.
Try using django.db.backends.XXX, where XXX is one of:
'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
Error was: cannot import name utils
what version of django is compatible with django-nonrel or do I have to do development using django-nonrel instead of Django-1.3.1 ?
As I read more on django-nonrel I feel that there are few modification needed to django code. Its not straight forward to just use the project as it is. I need to create abstract model super class and it does not support manytomanyfield which I use in my project.
I guess some one confirm these restriction then probably I can close this thread.
March 28
I removed M2M from my app. It was very minor thing just commented out M2M field.
Now I have installed python2.7.2, gae 1.6.4 and djangoappengine gives error as below:
E:\learn\python\event>python manage.py runserver
WARNING:root:E:\software\Google\google_appengine\lib\cacerts\urlfetch_cacerts.tx
t missing; without this urlfetch will not be able to validate SSL certificates.
Traceback (most recent call last):
File "manage.py", line 4, in <module>
import settings # Assumed to be in the same directory.
File "E:\learn\python\event\settings.py", line 4, in <module>
from djangoappengine.settings_base import *
File "E:\learn\python\event\djangoappengine\settings_base.py", line 6, in <mod
ule>
setup_env()
File "E:\learn\python\event\djangoappengine\boot.py", line 69, in setup_env
setup_project()
File "E:\learn\python\event\djangoappengine\boot.py", line 123, in setup_proje
ct
from .utils import have_appserver, on_production_server
File "E:\learn\python\event\djangoappengine\utils.py", line 14, in <module>
default_partition='dev')[0]
TypeError: LoadAppConfig() got an unexpected keyword argument 'default_partition
'
Regards,
Miten.
You can't just replace the version of Django in nonrel. It's actually a fork of Django, with a number of customizations.
Django-1.3.1/Django's database models do not work on Google App Engine.
Django-nonrel implements a backend so that Django models will work on Google App Engine.
So if you want to use Django models, you must use Django-nonrel. Otherwise, you can use Django for templating/forms, but you need to use Google App Engine's db.Model or ndb.Model based models.