Deployment Architecture

Why are Django apps suddenly not working on the search head with error "root:645 - The SECRET_KEY setting must not be empty."?

madan27
Explorer

Hi Splunkers,

Suddenly Django apps are not working in the Search head and we get the below error:

root:644 - DJANGO: There was an error starting:

root:645 - The SECRET_KEY setting must not be empty.

Please help me at the earliest.

Thanks

nnmiller
Contributor

I just had a customer with this problem on Splunk 6.4.1, ESS 4.1.0, and Threatstream 4.2.6-1. The Threatstream app had to be completely removed; disabling it was not enough.

jkat54
SplunkTrust
SplunkTrust

It seems as if you're using an application that is missing it's SECRET_KEY.

Did you install anything new?

0 Karma

madan27
Explorer

Threatstream app had settings.py in it. Suggested that bin folder which might have caused the error.

Removed the file and disabled the app and restarted Splunk

Still getting an error

"root:644 - DJANGO: There was an error starting: "
File "/opt/splunk/lib/python2.7/site-packages/splunk/appserver/mrsparkle/root.py", line 710, in configure_django

0 Karma

jkat54
SplunkTrust
SplunkTrust

I dont understand why you removed threatstream app because it had settings.py.

0 Karma

jkat54
SplunkTrust
SplunkTrust

What version of Splunk are you using?

Are you using search head clustering?

Does this key exist in server.conf?

[shclustering]
pass4SymmKey = yoursecuritykey

Are you using search head pooling? If so you set the password a bit differently.

http://docs.splunk.com/Documentation/Splunk/5.0/Deploy/Configuredistributedsearch

0 Karma

madan27
Explorer

Yes, The splunk version is 6.2.4 and server.conf has the setting.

We disabled threatstream app. removed settings.py from the bin folder and restarted splunk

Now we are getting root:645 - 'Settings' object has no attribute 'DISCOVERED_APPS'

PFB the latest Error logs as well.

Traceback (most recent call last):
File "/opt/splunk/lib/python2.7/site-packages/splunk/appserver/mrsparkle/root.py", line 642, in run
configure_django(global_cfg)
File "/opt/splunk/lib/python2.7/site-packages/splunk/appserver/mrsparkle/root.py", line 710, in configure_django
if should_start_django() or FORCE_ENABLE_DJANGO:
File "/opt/splunk/lib/python2.7/site-packages/splunk/appserver/mrsparkle/root.py", line 739, in should_start_django
return len(settings.DISCOVERED_APPS) > 0
File "/opt/splunk/lib/python2.7/site-packages/django/conf/init.py", line 54, in getattr
return getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'DISCOVERED_APPS'

Thanks,
Madan

0 Karma

jkat54
SplunkTrust
SplunkTrust

have you verified ownership / permissions on the folder, etc.?

are you executing splunk as root?

0 Karma

madan27
Explorer

No I did'nt install new app.

It was an already created Django app in splunk running good every time pushed changes and restarted.

This time facing secret key issue and the same not allowing us to run the home page of our app(i.e getting page not found issue)

0 Karma
Get Updates on the Splunk Community!

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...