lexpredict-contraxsuite-deploy icon indicating copy to clipboard operation
lexpredict-contraxsuite-deploy copied to clipboard

The SECRET_KEY setting must not be empty

Open ghost opened this issue 7 years ago • 7 comments

I am using ubuntu 16.04. I have generated a key online for django from http://www.miniwebtool.com/django-secret-key-generator/ then input in the /opt/lexpredict-contraxsuite/contraxsuite_services/settings.py as ( SECRET_KEY = "yj6o@&vrar6^l1u68!bxugj@xr4&5)zzk!h1qw&13^&@2d3wp#") and also in /opt/lexpredict-contraxsuite-deploy/local/local_settings.py files. after following all the steps of local machine installation setup mentioned in https://github.com/LexPredict/lexpredict-contraxsuite/blob/master/documentation/Installation%20and%20Configuration/Quick%20Start%20Installation%20Guide%20for%20Linux.pdf I am executing the following commad: bash setup_local.sh | tee -a log.txt

after few steps of exection, I am getting the following error: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty

need help to resolve this. I don't know where I am doing mistake.

ghost avatar Jul 17 '18 11:07 ghost

Currently we use docker based approach for application deployment, see https://github.com/LexPredict/lexpredict-contraxsuite/tree/master/docker

We had a lot of changes since we used lexpredict-contraxsuite-deploy for deployment last time. I made some important updates there and it should work now. So please update it using git pull and try again.

But I would recommend to use docker.

reddalexx avatar Jul 18 '18 09:07 reddalexx

@reddalexx : Even after taking the update of 'lexpredict-contraxsuite-deploy' using git pull, I am facing the same issue. Below is the stack trace.

$ /opt/ve/bin/celery multi restart worker -A apps -B -Q serial --concurrency=1 -Ofair -l DEBUG -n beat@%h -> [localhost] out: celery multi v4.2.0 (windowlicker) [localhost] out: Traceback (most recent call last): [localhost] out: File "/opt/ve/lib/python3.5/site-packages/celery/app/utils.py", line 365, in find_app [localhost] out: found = sym.app [localhost] out: AttributeError: module 'apps' has no attribute 'app' [localhost] out: [localhost] out: During handling of the above exception, another exception occurred: [localhost] out: [localhost] out: Traceback (most recent call last): [localhost] out: File "/opt/ve/lib/python3.5/site-packages/celery/app/utils.py", line 370, in find_app [localhost] out: found = sym.celery [localhost] out: AttributeError: module 'apps' has no attribute 'celery' [localhost] out: [localhost] out: During handling of the above exception, another exception occurred: [localhost] out: [localhost] out: Traceback (most recent call last): [localhost] out: File "/opt/ve/lib/python3.5/site-packages/celery/app/utils.py", line 359, in find_app [localhost] out: sym = symbol_by_name(app, imp=imp) [localhost] out: File "/opt/ve/lib/python3.5/site-packages/celery/bin/base.py", line 504, in symbol_by_name [localhost] out: return imports.symbol_by_name(name, imp=imp) [localhost] out: File "/opt/ve/lib/python3.5/site-packages/kombu/utils/imports.py", line 61, in symbol_by_name [localhost] out: return getattr(module, cls_name) if cls_name else module [localhost] out: AttributeError: module 'apps' has no attribute 'celery' [localhost] out: [localhost] out: During handling of the above exception, another exception occurred: [localhost] out: [localhost] out: Traceback (most recent call last): [localhost] out: File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main [localhost] out: "main", mod_spec) [localhost] out: File "/usr/lib/python3.5/runpy.py", line 85, in _run_code [localhost] out: exec(code, run_globals) [localhost] out: File "/opt/ve/lib/python3.5/site-packages/celery/main.py", line 20, in [localhost] out: main() [localhost] out: File "/opt/ve/lib/python3.5/site-packages/celery/main.py", line 16, in main [localhost] out: _main() [localhost] out: File "/opt/ve/lib/python3.5/site-packages/celery/bin/celery.py", line 322, in main [localhost] out: cmd.execute_from_commandline(argv) [localhost] out: File "/opt/ve/lib/python3.5/site-packages/celery/bin/celery.py", line 496, in execute_from_commandline [localhost] out: super(CeleryCommand, self).execute_from_commandline(argv))) [localhost] out: File "/opt/ve/lib/python3.5/site-packages/celery/bin/base.py", line 273, in execute_from_commandline [localhost] out: argv = self.setup_app_from_commandline(argv) [localhost] out: File "/opt/ve/lib/python3.5/site-packages/celery/bin/base.py", line 479, in setup_app_from_commandline [localhost] out: self.app = self.find_app(app) [localhost] out: File "/opt/ve/lib/python3.5/site-packages/celery/bin/base.py", line 501, in find_app [localhost] out: return find_app(app, symbol_by_name=self.symbol_by_name) [localhost] out: File "/opt/ve/lib/python3.5/site-packages/celery/app/utils.py", line 378, in find_app [localhost] out: symbol_by_name=symbol_by_name, imp=imp, [localhost] out: File "/opt/ve/lib/python3.5/site-packages/celery/app/utils.py", line 362, in find_app [localhost] out: sym = imp(app) [localhost] out: File "/opt/ve/lib/python3.5/site-packages/celery/utils/imports.py", line 104, in import_from_cwd [localhost] out: return imp(module, package=package) [localhost] out: File "/opt/ve/lib/python3.5/importlib/init.py", line 126, in import_module [localhost] out: return _bootstrap._gcd_import(name[level:], package, level) [localhost] out: File "", line 986, in _gcd_import [localhost] out: File "", line 969, in _find_and_load [localhost] out: File "", line 958, in _find_and_load_unlocked [localhost] out: File "", line 673, in _load_unlocked [localhost] out: File "", line 665, in exec_module [localhost] out: File "", line 222, in _call_with_frames_removed [localhost] out: File "/opt/lexpredict-contraxsuite/contraxsuite_services/apps/celery.py", line 45, in [localhost] out: django.setup() [localhost] out: File "/opt/ve/lib/python3.5/site-packages/django/init.py", line 22, in setup [localhost] out: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) [localhost] out: File "/opt/ve/lib/python3.5/site-packages/django/conf/init.py", line 56, in getattr [localhost] out: self._setup(name) [localhost] out: File "/opt/ve/lib/python3.5/site-packages/django/conf/init.py", line 41, in _setup [localhost] out: self._wrapped = Settings(settings_module) [localhost] out: File "/opt/ve/lib/python3.5/site-packages/django/conf/init.py", line 129, in init [localhost] out: raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.") [localhost] out: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty. [localhost] out: > Restarting node worker@beat@osboxes: * Child terminated with exit code 1 [localhost] out: FAILED [localhost] out:

Fatal error: run() received nonzero return code 1 while executing!

Requested: /opt/ve/bin/celery multi restart worker -A apps -B -Q serial --concurrency=1 -Ofair -l DEBUG -n beat@%h Executed: /bin/bash -l -c "cd /opt/lexpredict-contraxsuite/contraxsuite_services >/dev/null && /opt/ve/bin/celery multi restart worker -A apps -B -Q serial --concurrency=1 -Ofair -l DEBUG -n beat@%h"

Aborting. Disconnecting from localhost... done.

ghost avatar Jul 18 '18 10:07 ghost

That means that probably local_setting.py template wasn't transfered into destination folder. go to deploy folder cd lexpredict-contraxsuite-deploy activate virtual environment source ve/bin/activate run fab -c local/fabricrc upload_template_and_reload:settings to apply local settings run fab -c local/fabricrc start to start application then open browser at localhost

reddalexx avatar Jul 18 '18 21:07 reddalexx

@reddalexx: As per your suggestion, I have tried the docker setup and followed the steps mentioned here: https://github.com/LexPredict/lexpredict-contraxsuite/tree/master/docker But it didn't load the Contraxsuite application at http://localhost:65080 I have used a Clean Ubuntu 16.04 machine having more than 8GB RAM. Below are the screenshots attached of the step by step execution. screenshot from 2018-07-19 02-25-09 screenshot from 2018-07-19 02-26-58 screenshot from 2018-07-19 02-27-26 screenshot from 2018-07-19 02-28-00 screenshot from 2018-07-19 02-29-09 screenshot from 2018-07-19 02-29-17 screenshot from 2018-07-19 02-29-25 screenshot from 2018-07-19 02-39-44 screenshot from 2018-07-19 02-40-26 screenshot from 2018-07-19 02-43-28 screenshot from 2018-07-19 02-50-48 screenshot from 2018-07-19 02-52-11 screenshot from 2018-07-19 02-52-18 screenshot from 2018-07-19 02-52-40 screenshot from 2018-07-19 02-52-58

ghost avatar Jul 19 '18 07:07 ghost

@reddalexx: Any update on the above issue?

ghost avatar Jul 23 '18 05:07 ghost

@SandeepKumarJoshi @reddalexx I am having the same issues. For the first approach "lexpredict-contraxsuite-deploy", i used the script to copy the settings but then I ran to celery issue that is the application could not find "apps" worker. The second approach docker also does not work. The dockers are deployed but it shows the same errors for me as @SandeepKumarJoshi . Any help would suffice. Thanks.

talalzahid91 avatar Aug 16 '18 09:08 talalzahid91

I ran into the same issue: The SECRET_KEY setting must not be empty Udpate base/fabricrc with the SECRET Key SECRET_KEY = <secret key without @ to be specified without key>

Application is now up with few other issues like Email verification and Super User Account but was able to fix that.

SunnyMalikMicroland avatar Sep 05 '18 03:09 SunnyMalikMicroland