0

I am new at learning Django, I am using django-1.11.4. By default I was using python 2.7. I have gone through some of the similar questions but no luck. Please suggest.

This is my Traceback:

Traceback (most recent call last):
  File "C:/Users/skum/PQP_Bridge/qspraw7_data/views.py", line 8, in <module>
    from models import PqpModel
  File "C:\Users\skum\PQP_Bridge\qspraw7_data\models.py", line 14, in <module>
    class PqpModel(DjangoCassandraModel):
  File "C:\Python27\lib\site-packages\django_cassandra_engine\models\__init__.py", line 448, in __new__
    name=name
  File "C:\Python27\lib\site-packages\django_cassandra_engine\models\__init__.py", line 489, in _add_django_meta_and_register_model
    app_config = apps.get_containing_app_config(module)
  File "C:\Python27\lib\site-packages\django\apps\registry.py", line 247, in get_containing_app_config
    self.check_apps_ready()
  File "C:\Python27\lib\site-packages\django\apps\registry.py", line 125, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

These are the apps I installed:

INSTALLED_APPS = [
    'django_cassandra_engine',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'qspraw7_data.apps.Qspraw7DataConfig',
    'chartit',
]

apps.py;

from __future__ import unicode_literals

from django.apps import AppConfig


class Qspraw7DataConfig(AppConfig):
    name = 'qspraw7_data'
Sarabu Sandeep
  • 165
  • 2
  • 5
  • 14

1 Answers1

0

Try to run following commands

import django
django.setup()

If above not working try following changes

For django 1.7 and less version

import os
from django.core.handlers.wsgi import WSGIHandler

os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'
application = WSGIHandler()

For django 1.7 WSGI file:

import os
from django.core.wsgi import get_wsgi_application

os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'
application = get_wsgi_application()

May this helps you

NIKHIL RANE
  • 4,012
  • 2
  • 22
  • 45
  • File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 56, in __getattr__ self._setup(name) File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 39, in _setup % (desc, ENVIRONMENT_VARIABLE)) ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. – Sarabu Sandeep Sep 20 '17 at 10:23
  • when i run djange.setup() in python console, i got an error. i dont understand the error.please suggest – Sarabu Sandeep Sep 20 '17 at 10:25
  • Are you activate your django environment – NIKHIL RANE Sep 20 '17 at 10:30
  • Reffer this [link](https://stackoverflow.com/questions/25537905/django-1-7-throws-django-core-exceptions-appregistrynotready-models-arent-load?rq=1) – NIKHIL RANE Sep 20 '17 at 10:31
  • Django environment is up and running. – Sarabu Sandeep Sep 20 '17 at 10:39