Forums

ModuleNotFoundError in Tasks

Because when I run a task using my script in the virtual environment, does it return this error when importing some file that is in my project? Note: I'm importing my models, other libraries that I installed in the virtual environment it works normally, an example is BeautifulSoup.

See our page about how Python finds modules that you import: http://help.pythonanywhere.com/pages/DebuggingImportError/

I still can not, I get this error back: django.core.exceptions.AppRegistryNotReady: Apps are not loaded yet.

My file looks like this (in the import part):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#! / usr / bin / env python
import
import sys
path = "/ home / maarcosv99 / progpr"
if path not in sys.path:
     sys.path.append (path)

os.environ ["DJANGO_SETTINGS_MODULE"] = "progpr.settings.producao"

import requests
from bs4 import BeautifulSoup
from django.shortcuts import render
from administracao.models import Analise, Prognostico
from core.models import JogoAnaliseAoVivo, JogoAoVivo
from rest_framework.response import Response
from rest_framework.decorators import api_view

But even with that I can not execute.

There are many reasons why Django might give you the AppRegistryNotReady exception. See the Django documentation for details.