1

I'm stuck with a weird problem when I add a new app name in my INSTALLED_APPS in the settings.py file I get a 500 internal error.

This error happens only in production, in my local machine everything is working fine. If I remove the name of the app everything works fine again.

What I've already tried but didn't change anything:

  1. Setting DEBUG to Ture.
  2. Experiment with different types of apps (ex tinyMCE, adminsortable, grappelli, debug_toolbar etc.)
  3. Removing and re-installing these apps.
  4. Checking apps compatibility (with Django and Python versions or within their own dependencies)
  5. Checking the error.log file

If I check the error.log file I always get different outputs depending on the app I was adding to the settings.py file.

I will leave here the error.log output that I get when trying to use Django adminsortable which is the app that I'm actually trying to use.

The error is long that I've put it here

And this is my INSTALLED_APPS in settings.py

INSTALLED_APPS = [
    'blog.apps.BlogConfig',
    "users.apps.UsersConfig",
    "crispy_forms",
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    "taggit",
    "search",
    "photogallery",
    "django_filters",
    'adminsortable',
    'django_cleanup.apps.CleanupConfig',
] 

And here are the packages that I've already installed and their dependencies.

attrs==19.3.0
Automat==20.2.0
blinker==1.4
certifi==2020.4.5.1
chardet==3.0.4
click==7.1.2
cloud-init==20.4
colorama==0.4.3
command-not-found==0.3
configobj==5.0.6
constantly==15.1.0
cryptography==3.0
dbus-python==1.2.16
distro==1.5.0
distro-info==0.23ubuntu1
django-admin-sortable==2.2.4
  - django [required: Any, installed: 3.2.4]
    - asgiref [required: >=3.3.2,<4, installed: 3.6.0]
    - pytz [required: Any, installed: 2021.3]
    - sqlparse [required: >=0.2.2, installed: 0.4.2]
django-cleanup==5.2.0
django-crispy-forms==1.10.0
django-filter==2.4.0
  - Django [required: >=2.2, installed: 3.2.4]
    - asgiref [required: >=3.3.2,<4, installed: 3.6.0]
    - pytz [required: Any, installed: 2021.3]
    - sqlparse [required: >=0.2.2, installed: 0.4.2]
django-grappelli==3.0.6
django-taggit==1.3.0
  - Django [required: >=1.11, installed: 3.2.4]
    - asgiref [required: >=3.3.2,<4, installed: 3.6.0]
    - pytz [required: Any, installed: 2021.3]
    - sqlparse [required: >=0.2.2, installed: 0.4.2]
django-utils-six==2.0
hyperlink==19.0.0
idna==2.10
importlib-metadata==1.6.0
incremental==16.10.1
iotop==0.6
Jinja2==2.11.2
jsonpatch==1.25
jsonpointer==2.0
jsonschema==3.2.0
language-selector==0.1
launchpadlib==1.10.13
  - httplib2 [required: Any, installed: 0.18.1]
  - keyring [required: Any, installed: 21.3.0]
    - jeepney [required: >=0.4.2, installed: 0.4.3]
    - SecretStorage [required: >=3, installed: 3.1.2]
  - lazr.restfulclient [required: >=0.9.19, installed: 0.14.2]
    - httplib2 [required: >=0.7.7, installed: 0.18.1]
  - lazr.uri [required: Any, installed: 1.0.5]
  - setuptools [required: Any, installed: 49.3.1]
  - six [required: Any, installed: 1.15.0]
  - testresources [required: Any, installed: ?]
  - wadllib [required: Any, installed: 1.3.4]
MarkupSafe==1.1.1
more-itertools==4.2.0
netifaces==0.10.4
oauthlib==3.1.0
pexpect==4.6.0
Pillow==8.2.0
pip==20.1.1
pipdeptree==2.7.0
pyasn1==0.4.8
pyasn1-modules==0.2.1
PyGObject==3.38.0
  - pycairo [required: >=1.11.1, installed: ?]
PyHamcrest==1.9.0
PyJWT==1.7.1
pyOpenSSL==19.1.0
pyrsistent==0.15.5
pyserial==3.4
python-apt==2.1.3+ubuntu1.3
python-debian==0.1.37
PyYAML==5.3.1
requests==2.23.0
requests-unixsocket==0.2.0
service-identity==18.1.0
simplejson==3.17.0
sos==4.0
ssh-import-id==5.10
systemd-python==234
Twisted==18.9.0
ubuntu-advantage-tools==24.4
ufw==0.36
unattended-upgrades==0.1
urllib3==1.25.9
wheel==0.34.2
zipp==1.0.0
zope.interface==4.7.1

It feels very odd and frustrating because it seems like a wsgi problem but everything is working fine if I remove the newly added app. It doesn't seem to be a conflict between packages also because I've tried different apps and checked their compatibilities with the version of Django and Python that I'm using (Django 3.2.8 and Python 3.8.10)

I'm kind of lost ...

  • ModuleNotFoundError: No module named 'grappelli' – John Hanley May 05 '23 at 23:33
  • Does this answer your question? [Django stops working with RuntimeError: populate() isn't reentrant](https://stackoverflow.com/questions/27093746/django-stops-working-with-runtimeerror-populate-isnt-reentrant) – Ivan Starostin May 06 '23 at 09:08

1 Answers1

0

Please attach your code from urls.py and preferably views.py. The problem may be missing the right imports, or the wrong imports. I had such a problem. It turned out that the template originally created on the hosting had the line:

from django.urls import path

but it needed:

from django.urls import path, include 

I lost the "include" and didn't notice it for 2 hours. Please, check your urls.py files or send it to here. This is the first thing that comes to mind. I hope I could help someone.

Bihag Kashikar
  • 1,009
  • 1
  • 2
  • 13