I am troubleshooting an NGINX/Django/UWSGI application for a customer, that has been broken beyond expectations. I've been debugging code, and re-writing for 30+ hours now and am at another hurdle that I can't seem to get past on my own.

[pid: 336873|app: 0|req: 1/1] 198.11.30.68 () {46 vars in 1070 bytes} [Mon Dec  5 10:04:42 2022] GET / => generated 0 bytes in 393 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
announcing my loyalty to the Emperor...
Traceback (most recent call last):
  File "/home/django/django_venv/django_site/wsgi.py", line 26, in application
    get_wsgi_application();
  File "/home/django/django_venv/lib64/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    WSGIHandler();
  File "/home/django/django_venv/lib64/python3.6/site-packages/django/core/handlers/wsgi.py", line 127, in __init__
    self.load_middleware()
  File "/home/django/django_venv/lib64/python3.6/site-packages/django/core/handlers/base.py", line 40, in load_middleware
    middleware = import_string(middleware_path)
  File "/home/django/django_venv/lib64/python3.6/site-packages/django/utils/module_loading.py", line 17, in import_string
    module = import_module(module_path)
  File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/django/django_venv/lib64/python3.6/site-packages/django/contrib/auth/middleware.py", line 3, in <module>
    from django.contrib.auth.backends import RemoteUserBackend
  File "/home/django/django_venv/lib64/python3.6/site-packages/django/contrib/auth/backends.py", line 2, in <module>
    from django.contrib.auth.models import Permission
  File "/home/django/django_venv/lib64/python3.6/site-packages/django/contrib/auth/models.py", line 5, in <module>
    from django.contrib.contenttypes.models import ContentType
  File "/home/django/django_venv/lib64/python3.6/site-packages/django/contrib/contenttypes/models.py", line 133, in <module>
    class ContentType(models.Model):
  File "/home/django/django_venv/lib64/python3.6/site-packages/django/db/models/base.py", line 116, in __new__
    "INSTALLED_APPS." % (module, name)
RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
[pid: 336874|app: 0|req: 1/2] 198.11.30.68 () {46 vars in 1049 bytes} [Mon Dec  5 10:04:42 2022] GET /favicon.ico => generated 0 bytes in 393 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
announcing my loyalty to the Emperor...

So I can't get around this error message, and I am not sure how to move forward.

Also, here is my settings.py. Literally any help would be appreciated. Just going in circles right now.

import django.utils
from pathlib import Path
import six
import localsettings as secret
import urls
import sys
import os
import django
django.setup()
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = <removed for privacy>

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = [<removed for privacy>]
BASE_DIR = Path(__file__).resolve().parent.parent

# Application definition

INSTALLED_APPS = [
    'django.contrib.contenttypes',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.sites',
    'django.contrib.sessions',
    'django.contrib.messages',
    'wsgi.application',
    'acknowledgments.apps.AcknowledgmentsConfig',
    'data_sources.apps.DataSourcesConfig',
    'home.apps.HomeConfig',
    'igv.apps.IgvConfig',
    'organisms.apps.OrganismsConfig',
    'samples.apps.SamplesConfig',
    'search.apps.SearchConfig',
    'summary.apps.SummaryConfig',
    ]
#import django.contrib.contenttypes.models.ContentType
MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'urls'
SITE_ID = 1
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'django_site.templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = "wsgi.application"


# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases


DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': secret.db_name,
        'USER': secret.db_user,
        'PASSWORD': secret.db_token,
        'HOST': secret.db_host,
        }
    }



# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = '<removed for privacy>'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, "static/admin")
STATIC_URL ="static/admin/"

# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
0

There are 0 best solutions below