ctrl-alt-d / django-aula

Gestió de presencia, incidències i més en centres educatius i acadèmies.
Other
18 stars 28 forks source link

[BUG] ImportError: cannot import name 'python_2_unicode_compatible #103

Closed rafatecno1 closed 4 years ago

rafatecno1 commented 4 years ago

Seguint les indicacions de la guia per instal·lar django aula en un VPS creat expressament (Ubuntu 18.04 (64 Bit)), el sistema torna una errada en una de les passes descrites. Concretament en el pas:

(venv) root@proves:/opt/djau2020# python manage.py migrate

Sóc conscient que no he posar en producció el sistema amb l'usuari root, però ara per ara, i per fer proves, m'evito possibles errades de permisos per falta de coneixements.

L'errada que es produeix no permet continuar, per tant, dedueixo que és greu. És aquesta:

Traceback (most recent call last): File "manage.py", line 15, in execute_from_command_line(sys.argv) File "/opt/djau2020/venv/lib/python3.6/site-packages/django/core/management/init.py", line 401, in execute_from_command_line utility.execute() File "/opt/djau2020/venv/lib/python3.6/site-packages/django/core/management/init.py", line 377, in execute django.setup() File "/opt/djau2020/venv/lib/python3.6/site-packages/django/init.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/opt/djau2020/venv/lib/python3.6/site-packages/django/apps/registry.py", line 114, in populate app_config.import_models() File "/opt/djau2020/venv/lib/python3.6/site-packages/django/apps/config.py", line 211, in import_models self.models_module = import_module(models_module_name) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/opt/djau2020/aula/apps/sortides/models.py", line 9, in from django.utils.encoding import python_2_unicode_compatible ImportError: cannot import name 'python_2_unicode_compatible'

Fins aquest punt, he seguit escrupolosament les passes descrites a la guia en aquest github i no he tingut cap problema.

La versió de django és la 3.0.5 sobre python

(venv) root@proves:/opt/djau2020# pip --version pip 9.0.1 from /opt/djau2020/venv/lib/python3.6/site-packages (python 3.6)

Cercant, he trobat aquesta referència que, potser, solucioni el problema, però no tinc coneixements ni per solucionar-ho ni tant sols per provar-ho.

ctrl-alt-d commented 4 years ago

Hola @amorilla ,

em sembla que aquesta issue està relacionada amb la PR #102. Pot ser?

Series tan amable, @amorilla, de fer el merge de totes les teves PRs sobre master?

Un cop fet ens mirem si aquesta issue persisteix per poder ajudar a @freeride-rafa.

Salut i merci per les contricions.

amorilla commented 4 years ago

Hola, Efectivament és per la versió de Django. He actualitzat el master. Des de la carpeta on hi ha la instal·lació de Djau s'ha de fer: git fetch git pull

Salutacions.

amorilla commented 4 years ago

M'he oblidat que després s'ha de repetir: source venv/bin/activate pip install -r requirements.txt python manage.py migrate

rafatecno1 commented 4 years ago

Merci per la rapidesa.

He seguit les noves passes, @amorilla, però ara apareix una altra errada:

(venv) root@proves:/opt/djau2020# python manage.py migrate Traceback (most recent call last): File "manage.py", line 15, in execute_from_command_line(sys.argv) File "/opt/djau2020/venv/lib/python3.6/site-packages/django/core/management/init.py", line 401, in execute_from_command_line utility.execute() File "/opt/djau2020/venv/lib/python3.6/site-packages/django/core/management/init.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/djau2020/venv/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv self.execute(*args, cmd_options) File "/opt/djau2020/venv/lib/python3.6/site-packages/django/core/management/base.py", line 366, in execute self.check() File "/opt/djau2020/venv/lib/python3.6/site-packages/django/core/management/base.py", line 395, in check include_deployment_checks=include_deployment_checks, File "/opt/djau2020/venv/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 64, in _run_checks issues.extend(super()._run_checks(kwargs)) File "/opt/djau2020/venv/lib/python3.6/site-packages/django/core/management/base.py", line 382, in _run_checks return checks.run_checks(**kwargs) File "/opt/djau2020/venv/lib/python3.6/site-packages/django/core/checks/registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "/opt/djau2020/venv/lib/python3.6/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique all_namespaces = _load_all_namespaces(resolver) File "/opt/djau2020/venv/lib/python3.6/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces url_patterns = getattr(resolver, 'url_patterns', []) File "/opt/djau2020/venv/lib/python3.6/site-packages/django/utils/functional.py", line 48, in get res = instance.dict[self.name] = self.func(instance) File "/opt/djau2020/venv/lib/python3.6/site-packages/django/urls/resolvers.py", line 588, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/opt/djau2020/venv/lib/python3.6/site-packages/django/utils/functional.py", line 48, in get res = instance.dict[self.name] = self.func(instance) File "/opt/djau2020/venv/lib/python3.6/site-packages/django/urls/resolvers.py", line 581, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/opt/djau2020/aula/urls.py", line 41, in url(r'^sortides/', include('aula.apps.sortides.urls')), File "/opt/djau2020/venv/lib/python3.6/site-packages/django/urls/conf.py", line 34, in include urlconf_module = import_module(urlconf_module) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/opt/djau2020/aula/apps/sortides/urls.py", line 2, in from aula.apps.sortides import views as sortides_views File "/opt/djau2020/aula/apps/sortides/views.py", line 16, in from aula.settings_local import CUSTOM_CODI_COMERÇ, CUSTOM_KEY_COMERÇ, URL_DJANGO_AULA ImportError: cannot import name 'CUSTOM_CODI_COMERÇ'

ctrl-alt-d commented 4 years ago

hola @freeride-rafa ,

en @juaky, a l'Agost, va introduir el pagament online de les sortides. Calen dues variables més que, encara que no facis pagaments online, han d'estar definides.

Les has de posar al settings_local.py com a l'exemple :

CUSTOM_CODI_COMERÇ = 'xxxxxx'
CUSTOM_KEY_COMERÇ = 'xxxxxx'

@juaky, @amorilla , pensem-hi a posar-ho a la documentació a pròximes versions.

Deixo oberta la issue per tal que ens cofirmis si és això.

rafatecno1 commented 4 years ago

Hola @ctrl-alt-d, efectivament era això. He pogut arribar al final de la instal·lació però en el apache reload ha aparegut una errada que encara he d'investigar, per saber si és error meu o no. Per mi, aquesta issue es pot tancar.