Open ural2008 opened 10 years ago
Залил исправление в мастер. Прошу протестировать. Если все ок - сделаю релиз.
Попробовал (django 1.7, python 3.4+)
Exception Value:
cannot import name 'urlencode'
Exception Location: D:\Python33\lib\site-packages\loginza\views.py in
Exception Value:
No module named 'urllib2'
Exception Location: D:\Python33\lib\site-packages\loginza\views.py in
Exception Value:
name 'patterns' is not defined
Exception Location: D:\Python33\lib\site-packages\loginza\urls.py in
Знания Pythonа закончились - сдался :-)
cannot import name 'urlencode'
No module named 'urllib2'
Это python 3.4+ - у меня 2.7, писал под них. Почитал ман - в 3 их убрали в дргие модули, нужно будет адаптировать. С импортами джанги уже сложнее. Попробую развернуть у себя на 3, может получится воспроизвести.
Внес исправления в мастер - прошу протестировать.
Установка: D:\myflat\Examples\django-loginza-master\django-loginza-master>python setup.py install running install running bdist_egg running egg_info creating django_loginza.egg-info writing top-level names to django_loginza.egg-info\top_level.txt writing django_loginza.egg-info\PKG-INFO writing requirements to django_loginza.egg-info\requires.txt writing dependency_links to django_loginza.egg-info\dependency_links.txt writing manifest file 'django_loginza.egg-info\SOURCES.txt' reading manifest file 'django_loginza.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'django_loginza.egg-info\SOURCES.txt' installing library code to build\bdist.win32\egg running install_lib running build_py creating build creating build\lib creating build\lib\loginza copying loginza\admin.py -> build\lib\loginza copying loginza\authentication.py -> build\lib\loginza copying loginza\decorators.py -> build\lib\loginza copying loginza\models.py -> build\lib\loginza copying loginza\signals.py -> build\lib\loginza copying loginza\tests.py -> build\lib\loginza copying loginza\urls.py -> build\lib\loginza copying loginza\views.py -> build\lib\loginza copying loginzainit.py -> build\lib\loginza creating build\lib\loginza\conf copying loginza\conf\settings.py -> build\lib\loginza\conf copying loginza\confinit.py -> build\lib\loginza\conf creating build\lib\loginza\templatetags copying loginza\templatetags\loginza_widget.py -> build\lib\loginza\templatetags
copying loginza\templatetagsinit.py -> build\lib\loginza\templatetags creating build\lib\loginza\locale creating build\lib\loginza\locale\ru creating build\lib\loginza\locale\ru\LC_MESSAGES copying loginza\locale\ru\LC_MESSAGES\django.mo -> build\lib\loginza\locale\ru\L C_MESSAGES copying loginza\locale\ru\LC_MESSAGES\django.po -> build\lib\loginza\locale\ru\L C_MESSAGES creating build\bdist.win32 creating build\bdist.win32\egg creating build\bdist.win32\egg\loginza copying build\lib\loginza\admin.py -> build\bdist.win32\egg\loginza copying build\lib\loginza\authentication.py -> build\bdist.win32\egg\loginza creating build\bdist.win32\egg\loginza\conf copying build\lib\loginza\conf\settings.py -> build\bdist.win32\egg\loginza\conf
copying build\lib\loginza\confinit.py -> build\bdist.win32\egg\loginza\conf
copying build\lib\loginza\decorators.py -> build\bdist.win32\egg\loginza creating build\bdist.win32\egg\loginza\locale creating build\bdist.win32\egg\loginza\locale\ru creating build\bdist.win32\egg\loginza\locale\ru\LC_MESSAGES copying build\lib\loginza\locale\ru\LC_MESSAGES\django.mo -> build\bdist.win32\e gg\loginza\locale\ru\LC_MESSAGES copying build\lib\loginza\locale\ru\LC_MESSAGES\django.po -> build\bdist.win32\e gg\loginza\locale\ru\LC_MESSAGES copying build\lib\loginza\models.py -> build\bdist.win32\egg\loginza copying build\lib\loginza\signals.py -> build\bdist.win32\egg\loginza creating build\bdist.win32\egg\loginza\templatetags copying build\lib\loginza\templatetags\loginza_widget.py -> build\bdist.win32\eg g\loginza\templatetags copying build\lib\loginza\templatetagsinit.py -> build\bdist.win32\egg\logi nza\templatetags copying build\lib\loginza\tests.py -> build\bdist.win32\egg\loginza copying build\lib\loginza\urls.py -> build\bdist.win32\egg\loginza copying build\lib\loginza\views.py -> build\bdist.win32\egg\loginza copying build\lib\loginzainit.py -> build\bdist.win32\egg\loginza byte-compiling build\bdist.win32\egg\loginza\admin.py to admin.cpython-34.pyc byte-compiling build\bdist.win32\egg\loginza\authentication.py to authentication .cpython-34.pyc byte-compiling build\bdist.win32\egg\loginza\conf\settings.py to settings.cpytho n-34.pyc byte-compiling build\bdist.win32\egg\loginza\confinit.py to init.cpytho n-34.pyc byte-compiling build\bdist.win32\egg\loginza\decorators.py to decorators.cpython -34.pyc byte-compiling build\bdist.win32\egg\loginza\models.py to models.cpython-34.pyc byte-compiling build\bdist.win32\egg\loginza\signals.py to signals.cpython-34.py c byte-compiling build\bdist.win32\egg\loginza\templatetags\loginza_widget.py to l oginzawidget.cpython-34.pyc byte-compiling build\bdist.win32\egg\loginza\templatetagsinit.py to **init _.cpython-34.pyc byte-compiling build\bdist.win32\egg\loginza\tests.py to tests.cpython-34.pyc byte-compiling build\bdist.win32\egg\loginza\urls.py to urls.cpython-34.pyc byte-compiling build\bdist.win32\egg\loginza\views.py to views.cpython-34.pyc byte-compiling build\bdist.win32\egg\loginza__init.py to init**.cpython-34. pyc creating build\bdist.win32\egg\EGG-INFO copying django_loginza.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO copying django_loginza.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO copying django_loginza.egg-info\dependency_links.txt -> build\bdist.win32\egg\EG G-INFO copying django_loginza.egg-info\not-zip-safe -> build\bdist.win32\egg\EGG-INFO copying django_loginza.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO copying django_loginza.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO creating dist creating 'dist\django_loginza-0.4.0-py3.4.egg' and adding 'build\bdist.win32\egg ' to it removing 'build\bdist.win32\egg' (and everything under it) Processing django_loginza-0.4.0-py3.4.egg creating d:\python33\lib\site-packages\django_loginza-0.4.0-py3.4.egg Extracting django_loginza-0.4.0-py3.4.egg to d:\python33\lib\site-packages Adding django-loginza 0.4.0 to easy-install.pth file
Installed d:\python33\lib\site-packages\django_loginza-0.4.0-py3.4.egg Processing dependencies for django-loginza==0.4.0 Searching for Django==1.7 Best match: Django 1.7 Adding Django 1.7 to easy-install.pth file Deleting D:\Python33\Scripts\django-admin.py Installing django-admin-script.py script to D:\Python33\Scripts Installing django-admin.exe script to D:\Python33\Scripts Installing django-admin.exe.manifest script to D:\Python33\Scripts
Using d:\python33\lib\site-packages
Запуск: D:\myflat\Examples\django-loginza-master\django-loginza-master>cd test_project
D:\myflat\Examples\django-loginza-master\django-loginza-master\test_project>mana ge.py runserver Performing system checks...
System check identified some issues:
WARNINGS: ?: (1_6.W001) Some project unittests may not execute as expected. HINT: Django 1.6 introduced a new default test runner. It looks like thi s project was generated using Django 1.5 or earlier. You should ensure your test s are all running & behaving as expected. See https://docs.djangoproject.com/en/ dev/releases/1.6/#new-test-runner for more information.
System check identified 1 issue (0 silenced). October 02, 2014 - 16:25:28 Django version 1.7, using settings 'settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK. Internal Server Error: / Traceback (most recent call last): File "D:\Python33\lib\site-packages\django\core\urlresolvers.py", line 359, in urlconf_module return self._urlconf_module AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Python33\lib\site-packages\django\core\handlers\base.py", line 98, in
get_response
resolver_match = resolver.resolve(request.path_info)
File "D:\Python33\lib\site-packages\django\core\urlresolvers.py", line 338, in
resolve
for pattern in self.url_patterns:
File "D:\Python33\lib\site-packages\django\core\urlresolvers.py", line 367, in
url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "D:\Python33\lib\site-packages\django\core\urlresolvers.py", line 361, in
urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "D:\Python33\lib\importlibinit.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Python33\lib\site-packages\django\core\handlers\base.py", line 87, in
get_response
response = middleware_method(request)
File "D:\Python33\lib\site-packages\django\middleware\common.py", line 72, in
process_request
if (not urlresolvers.is_valid_path(request.path_info, urlconf) and
File "D:\Python33\lib\site-packages\django\core\urlresolvers.py", line 614, in
is_valid_path
resolve(path, urlconf)
File "D:\Python33\lib\site-packages\django\core\urlresolvers.py", line 489, in
resolve
return get_resolver(urlconf).resolve(path)
File "D:\Python33\lib\site-packages\django\core\urlresolvers.py", line 338, in
resolve
for pattern in self.url_patterns:
File "D:\Python33\lib\site-packages\django\core\urlresolvers.py", line 367, in
url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "D:\Python33\lib\site-packages\django\core\urlresolvers.py", line 361, in
urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "D:\Python33\lib\importlibinit.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
Браузер:
ImportError at /
No module named 'test_project'
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.7
Exception Type: ImportError
Exception Value:
No module named 'test_project'
Exception Location: D:\Python33\lib\importlibinit.py in import_module, line 109
Python Executable: D:\Python33\python.EXE
Python Version: 3.4.1
Python Path:
['D:\myflat\Examples\django-loginza-master\django-loginza-master\test_project',
'D:\Python33\lib\site-packages\django_loginza-0.4.0-py3.4.egg',
'C:\windows\SYSTEM32\python34.zip',
'D:\Python33\DLLs',
'D:\Python33\lib',
'D:\Python33',
'D:\Python33\lib\site-packages']
Server time: Чтв, 2 Окт 2014 16:25:45 +0600
Traceback Switch to copy-and-paste view
D:\Python33\lib\site-packages\django\core\handlers\base.py in get_response resolver_match = resolver.resolve(request.path_info) ... ▶ Local vars D:\Python33\lib\site-packages\django\core\urlresolvers.py in resolve for pattern in self.url_patterns: ... ▶ Local vars D:\Python33\lib\site-packages\django\core\urlresolvers.py in url_patterns
Далее на примере payforward (после допилирования до Python3) ругается:
AttributeError at /
'module' object has no attribute 'quote'
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.7
Exception Type: AttributeError
Exception Value:
'module' object has no attribute 'quote'
На строку шаблона: {% loginza_iframe providers_set="google,facebook,twitter" lang="en" %}
Меняю в django-loginze: def return_url():
return urllib.parse.quote(_absolute_url(reverse('loginza.views.return_callback')), '')
И работает!
Та же проблема с py3k - поправил и ее
При попытке использовать django-loginza (django 1.7, python 3.3+):
D:\myflat>manage.py syncdb Traceback (most recent call last): File "D:\myflat\manage.py", line 10, in
execute_from_command_line(sys.argv)
File "D:\Python33\lib\site-packages\django\core\managementinit.py", line
385, in execute_from_command_line
utility.execute()
File "D:\Python33\lib\site-packages\django\core\managementinit.py", line
354, in execute
django.setup()
File "D:\Python33\lib\site-packages\djangoinit.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "D:\Python33\lib\site-packages\django\apps\registry.py", line 108, in pop
ulate
app_config.import_models(all_models)
File "D:\Python33\lib\site-packages\django\apps\config.py", line 197, in impor
t_models
self.models_module = import_module(models_module_name)
File "D:\Python33\lib\importlibinit.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 2254, in _gcd_import
File "", line 2237, in _find_and_load
File "", line 2226, in _find_and_load_unlocked
File "", line 1200, in _load_unlocked
File "", line 1129, in _exec
File "", line 1471, in exec_module
File "", line 321, in _call_with_frames_removed
File "D:\Python33\lib\site-packages\loginza\models.py", line 7, in
User = get_user_model()
File "D:\Python33\lib\site-packages\django\contrib\authinit.py", line 136
, in get_user_model
return django_apps.get_model(settings.AUTH_USER_MODEL)
File "D:\Python33\lib\site-packages\django\apps\registry.py", line 199, in get
_model
self.check_models_ready()
File "D:\Python33\lib\site-packages\django\apps\registry.py", line 131, in che
ck_models_ready
raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
D:\myflat>RunServer.bat
D:\myflat>manage.py runserver Traceback (most recent call last): File "D:\myflat\manage.py", line 10, in
execute_from_command_line(sys.argv)
File "D:\Python33\lib\site-packages\django\core\managementinit.py", line
385, in execute_from_command_line
utility.execute()
File "D:\Python33\lib\site-packages\django\core\managementinit.py", line
354, in execute
django.setup()
File "D:\Python33\lib\site-packages\djangoinit.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "D:\Python33\lib\site-packages\django\apps\registry.py", line 108, in pop
ulate
app_config.import_models(all_models)
File "D:\Python33\lib\site-packages\django\apps\config.py", line 197, in impor
t_models
self.models_module = import_module(models_module_name)
File "D:\Python33\lib\importlibinit.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 2254, in _gcd_import
File "", line 2237, in _find_and_load
File "", line 2226, in _find_and_load_unlocked
File "", line 1200, in _load_unlocked
File "", line 1129, in _exec
File "", line 1471, in exec_module
File "", line 321, in _call_with_frames_removed
File "D:\Python33\lib\site-packages\loginza\models.py", line 7, in
User = get_user_model()
File "D:\Python33\lib\site-packages\django\contrib\authinit.py", line 136
, in get_user_model
return django_apps.get_model(settings.AUTH_USER_MODEL)
File "D:\Python33\lib\site-packages\django\apps\registry.py", line 199, in get
_model
self.check_models_ready()
File "D:\Python33\lib\site-packages\django\apps\registry.py", line 131, in che
ck_models_ready
raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.