Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Environment variable not set :SECRET_KEY #55

Open
cahaya42 opened this issue Feb 9, 2023 · 1 comment
Open

Environment variable not set :SECRET_KEY #55

cahaya42 opened this issue Feb 9, 2023 · 1 comment

Comments

@cahaya42
Copy link

cahaya42 commented Feb 9, 2023

After a fresh install, I ran librephotos-cli clear_cache

Traceback (most recent call last):
  File "/usr/lib/librephotos/backend/manage.py", line 11, in <module>
	execute_from_command_line(sys.argv)
  File "/usr/lib/librephotos/.local/lib/python3.8/site-packages/django/core/management/init.py", line 401, in execute_from_command_line
	utility.execute()
  File "/usr/lib/librephotos/.local/lib/python3.8/site-packages/django/core/management/init.py", line 345, in execute
	settings.INSTALLED_APPS
  File "/usr/lib/librephotos/.local/lib/python3.8/site-packages/django/conf/init.py", line 82, in getattr
	self._setup(name)
  File "/usr/lib/librephotos/.local/lib/python3.8/site-packages/django/conf/init.py", line 69, in _setup
	self._wrapped = Settings(settings_module)
  File "/usr/lib/librephotos/.local/lib/python3.8/site-packages/django/conf/init.py", line 170, in init
	mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
	return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/librephotos/backend/ownphotos/settings.py", line 26, in <module>
	raise NameError("Environment variable not set :" + envvar)
NameError: Environment variable not set :SECRET_KEY

Solution
Add the following line to /etc/librephotos/librephotos-backend.env

SECRET_KEY=$BASE_LOGS/secret.key

Ideally, this should be added to resources/etc/librephotos/librephotos-backend.env

@derneuere
Copy link
Member

https://github.com/LibrePhotos/librephotos-linux/blob/main/resources/bin/librephotos-backend

It should read out the secret key anyway, because of this entrypoint file. We either create a new one and read it, or we read an old one. I am not sure, why it's not working on your system.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants