Django deployment with apache server error

Issue

This Content is from Stack Overflow. Question asked by hiwa

I have a django application deployed on apache server.
following is os and apache details:

Server Version: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f mod_wsgi/4.6.8 Python/3.8

when restarting apache and trying to access website i have this error:

 /var/www/backend/venv2/lib/python3.8/site-packages/pandas/__init__.py:11: UserWarning: NumPy was imported from a Python sub-interpreter but NumPy does not properly support sub-interpreters. This will likely work for most users but might cause hard to track down issues or subtle bugs. A common user of the rare sub-interpreter feature is wsgi which also allows single-interpreter mode.

 [wsgi:error] Improvements in the case of bugs are welcome, but is not on the NumPy roadmap, and full support may require significant effort to achieve.
....

[wsgi:error]
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")

[wsgi:error] django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

as you can see first it gives me a warning about numpy and after it, it gives me error about SECRET_KEY which supposed to read it from environment variables.

SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')

for this issue i read couple of texts and other stackoverflow questions and i even tried following directive inside my apache config file.

WSGIApplicationGroup %{GLOBAL}

but still nothing.



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?