Skip to main content
removeu 2832 caracteres do conteúdo
Fonte Link
Leila
  • 1,3mil
  • 3
  • 15
  • 42

Quando rodo o runserver, aparece o erro django.core.exceptions.ImproperlyConfigured: The included URLconf 'cedimfinanceiro'projeto.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

Já pesquisei e tentei várias coisas que encontrei, mas nada está funcionando. Se alguém puder ajudar agradeço.

Traceback completo:

Exception in thread django-main-thread: Traceback (most recent call last): File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/urls/resolvers.py", line 581, in url_patterns iter(patterns) TypeError: 'module' object is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/utils/autoreload.py", line 54, in wrapper fn(*args, **kwargs) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run self.check(display_num_errors=True) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/management/base.py", line 390, in check include_deployment_checks=include_deployment_checks, File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/management/base.py", line 377, in _run_checks return checks.run_checks(**kwargs) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/checks/registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/checks/urls.py", line 13, in check_url_config return check_resolver(resolver) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/checks/urls.py", line 23, in check_resolver return check_method() File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/urls/resolvers.py", line 398, in check for pattern in self.url_patterns: File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/utils/functional.py", line 80, in get res = instance.dict[self.name] = self.func(instance) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/urls/resolvers.py", line 588, in url_patterns raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) django.core.exceptions.ImproperlyConfigured: The included URLconf 'cedimfinanceiro.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

from django.db import models

class Expense(models.Model):
    TYPE = (
        ('Type1', 'Type1'),
        ('Type2', 'Type2'),
        ('Type3', 'Type3'),
        ('Outros', 'Outros') #abre um campo para digitar
    )

    type = models.CharField(max_length=10, choices=TYPE, null=True, blank=True) #foreign key do cedimtech
    value = models.FloatField(null=True, blank=True)
    num_installments = models.IntegerField(null=True, blank=True) #parcelas
    day_installments = models.IntegerField(null=True, blank=True) #dia de pagamento de cada parcela

Quando rodo o runserver, aparece o erro django.core.exceptions.ImproperlyConfigured: The included URLconf 'cedimfinanceiro.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

Já pesquisei e tentei várias coisas que encontrei, mas nada está funcionando. Se alguém puder ajudar agradeço.

Traceback completo:

Exception in thread django-main-thread: Traceback (most recent call last): File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/urls/resolvers.py", line 581, in url_patterns iter(patterns) TypeError: 'module' object is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/utils/autoreload.py", line 54, in wrapper fn(*args, **kwargs) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run self.check(display_num_errors=True) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/management/base.py", line 390, in check include_deployment_checks=include_deployment_checks, File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/management/base.py", line 377, in _run_checks return checks.run_checks(**kwargs) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/checks/registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/checks/urls.py", line 13, in check_url_config return check_resolver(resolver) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/checks/urls.py", line 23, in check_resolver return check_method() File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/urls/resolvers.py", line 398, in check for pattern in self.url_patterns: File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/utils/functional.py", line 80, in get res = instance.dict[self.name] = self.func(instance) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/urls/resolvers.py", line 588, in url_patterns raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) django.core.exceptions.ImproperlyConfigured: The included URLconf 'cedimfinanceiro.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

from django.db import models

class Expense(models.Model):
    TYPE = (
        ('Type1', 'Type1'),
        ('Type2', 'Type2'),
        ('Type3', 'Type3'),
        ('Outros', 'Outros') #abre um campo para digitar
    )

    type = models.CharField(max_length=10, choices=TYPE, null=True, blank=True) #foreign key do cedimtech
    value = models.FloatField(null=True, blank=True)
    num_installments = models.IntegerField(null=True, blank=True) #parcelas
    day_installments = models.IntegerField(null=True, blank=True) #dia de pagamento de cada parcela

Quando rodo o runserver, aparece o erro django.core.exceptions.ImproperlyConfigured: The included URLconf 'projeto.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

Já pesquisei e tentei várias coisas que encontrei, mas nada está funcionando. Se alguém puder ajudar agradeço.

from django.db import models

class Expense(models.Model):
    TYPE = (
        ('Type1', 'Type1'),
        ('Type2', 'Type2'),
        ('Type3', 'Type3'),
        ('Outros', 'Outros') #abre um campo para digitar
    )

    type = models.CharField(max_length=10, choices=TYPE, null=True, blank=True) 
    value = models.FloatField(null=True, blank=True)
    num_installments = models.IntegerField(null=True, blank=True) #parcelas
    day_installments = models.IntegerField(null=True, blank=True) #dia de pagamento de cada parcela
adiciona estrutura do projeto
Fonte Link
Leila
  • 1,3mil
  • 3
  • 15
  • 42

estrutura do projeto

estrutura do projeto

Fonte Link
Leila
  • 1,3mil
  • 3
  • 15
  • 42

Erro ao incluir urls de um app no urls.py do projeto

Estou no começo de um projeto com Django 2.2.1, criando os primeiros apps e fazendo as ligações entre as páginas. No urls.py do projeto, incluindo as urls de accounts funcionou (com o include(accounts.urls), porém ao tentar fazer o mesmo para o app expenses náo estou conseguindo.

Quando rodo o runserver, aparece o erro django.core.exceptions.ImproperlyConfigured: The included URLconf 'cedimfinanceiro.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

Já pesquisei e tentei várias coisas que encontrei, mas nada está funcionando. Se alguém puder ajudar agradeço.

Traceback completo:

Exception in thread django-main-thread: Traceback (most recent call last): File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/urls/resolvers.py", line 581, in url_patterns iter(patterns) TypeError: 'module' object is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/utils/autoreload.py", line 54, in wrapper fn(*args, **kwargs) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run self.check(display_num_errors=True) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/management/base.py", line 390, in check include_deployment_checks=include_deployment_checks, File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/management/base.py", line 377, in _run_checks return checks.run_checks(**kwargs) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/checks/registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/checks/urls.py", line 13, in check_url_config return check_resolver(resolver) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/core/checks/urls.py", line 23, in check_resolver return check_method() File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/urls/resolvers.py", line 398, in check for pattern in self.url_patterns: File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/utils/functional.py", line 80, in get res = instance.dict[self.name] = self.func(instance) File "/home/ringa/anaconda3/envs/cedim-financeiro/lib/python3.5/site-packages/django/urls/resolvers.py", line 588, in url_patterns raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) django.core.exceptions.ImproperlyConfigured: The included URLconf 'cedimfinanceiro.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

urls.py do projeto

from django.contrib import admin
from django.urls import path, include
from django.views.generic.base import TemplateView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('expenses/', include('expenses.urls')),  # expenses app urls
    path('accounts/', include('accounts.urls')), #sign up
    path('accounts/', include('django.contrib.auth.urls')), #login and logout
    path('', TemplateView.as_view(template_name='home.html'), name='home'), #homepage
]

Arquivos do app expenses:

urls.py

from django.urls import path
from . import views

urlpatterns = [
    path('create/', views.CreateExpenseView.as_view(template_name='create_expense.html'), name='create-expense'), #create new expense
]

views.py

from django.views.generic.edit import CreateView  
from .forms import ExpenseForm

#view for create a new expense
class CreateExpenseView(CreateView):
    form_class = ExpenseForm
    template_name = 'templates/create_expense.html'

models.py

from django.db import models

class Expense(models.Model):
    TYPE = (
        ('Type1', 'Type1'),
        ('Type2', 'Type2'),
        ('Type3', 'Type3'),
        ('Outros', 'Outros') #abre um campo para digitar
    )

    type = models.CharField(max_length=10, choices=TYPE, null=True, blank=True) #foreign key do cedimtech
    value = models.FloatField(null=True, blank=True)
    num_installments = models.IntegerField(null=True, blank=True) #parcelas
    day_installments = models.IntegerField(null=True, blank=True) #dia de pagamento de cada parcela