Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Problema ao interpretar Forms com Class

Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Users\jumpe\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner self.run() File "C:\Users\jumpe\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 975, in run self._target(*self._args, **self._kwargs) File "C:\Users\jumpe\alura_space\venv\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper fn(*args, **kwargs) File "C:\Users\jumpe\alura_space\venv\Lib\site-packages\django\core\management\commands\runserver.py", line 133, in inner_run self.check(display_num_errors=True) File "C:\Users\jumpe\alura_space\venv\Lib\site-packages\django\core\management\base.py", line 485, in check all_issues = checks.run_checks( ^^^^^^^^^^^^^^^^^^ File "C:\Users\jumpe\alura_space\venv\Lib\site-packages\django\core\checks\registry.py", line 88, in run_checks new_errors = check(app_configs=app_configs, databases=databases) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jumpe\alura_space\venv\Lib\site-packages\django\core\checks\urls.py", line 42, in check_url_namespaces_unique all_namespaces = _load_all_namespaces(resolver) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jumpe\alura_space\venv\Lib\site-packages\django\core\checks\urls.py", line 61, in load_all_namespaces url_patterns = getattr(resolver, "url_patterns", []) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jumpe\alura_space\venv\Lib\site-packages\django\utils\functional.py", line 57, in get res = instance.dict[self.name] = self.func(instance) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\jumpe\alura_space\venv\Lib\site-packages\django\urls\resolvers.py", line 715, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\jumpe\alura_space\venv\Lib\site-packages\django\utils\functional.py", line 57, in get res = instance.dict[self.name] = self.func(instance) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\jumpe\alura_space\venv\Lib\site-packages\django\urls\resolvers.py", line 708, in urlconf_module return import_module(self.urlconf_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jumpe\AppData\Local\Programs\Python\Python311\Lib\importlib_init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1206, in _gcd_import File "", line 1178, in _find_and_load File "", line 1149, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "", line 940, in exec_module File "", line 241, in call_with_frames_removed File "C:\Users\jumpe\alura_space\setup\urls.py", line 30, in path('', include('usuarios.urls')) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jumpe\alura_space\venv\Lib\site-packages\django\urls\conf.py", line 38, in include urlconf_module = import_module(urlconf_module) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jumpe\AppData\Local\Programs\Python\Python311\Lib\importlib_init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1206, in _gcd_import File "", line 1178, in _find_and_load File "", line 1149, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "C:\Users\jumpe\alura_space\usuarios\urls.py", line 2, in from usuarios.views import login, cadastro File "C:\Users\jumpe\alura_space\usuarios\views.py", line 2, in from usuarios.forms import LoginForms File "C:\Users\jumpe\alura_space\usuarios\forms.py", line 3, in class LoginForms(forms.Form): File "C:\Users\jumpe\alura_space\usuarios\forms.py", line 4, in LoginForms nome_login=forms.CharField( ^^^^^^^^^^^^^^^^ File "C:\Users\jumpe\alura_space\venv\Lib\site-packages\django\forms\fields.py", line 267, in init super().init(**kwargs) TypeError: Field.init() got an unexpected keyword argument 'Label'

1 resposta
solução!

Um tópico do Franklin Espindola Neto me ajudou

Abra o novo projeto e abra o terminal e digite:

Get-ExecutionPolicy -List

Vai aparecer isso ou um pouco diferente:

Scope ExecutionPolicy

MachinePolicy Undefined UserPolicy Undefined Process Undefined CurrentUser Undefined LocalMachine AllSigned

Alterei o meu CurrentUser para aceitar execução de Scripts desta maneira:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Depois executei a seguinte sequencia em ordem:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py

obs: Antes de fazer os comandos abaixo voc/~e deve desativar venv caso esteja aivado .\venv\Scripts\deactivate

lINUX virtualenv -p python3 . venv .venv\Scripts\Activate.ps1

Windows python -m venv venv .\venv\Scripts\Activate

não consegui fazer essa parte aqui mas tem lógica pq python alura space que baixei do GITHUB deve ter uma versão diferente do que eu uso, mas mesmo assim segui os passos { Com o " ctrl+shift+p " busquei selecionar interpretador, fui em "insira o caminho do interpretador.."

Abri a pasta .venv/Scripts Selecionei python.exe Depois executei: }

pip install -r requirements.txt python manage.py makemigrations obs: se aqui ele pedir para reinstalar algum pacote reinstale python manage.py migrate

obs: Essa parte do usuário já tinha meu usuário que tinha feito antes mas mesmo assim criei outro Criei um novo superuser com: python manage.py createsuperuser

Comando: https://learn.microsoft.com/pt-br/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.3