[GH-ISSUE #288] Bugfix: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty. #3226

Closed
opened 2026-03-14 21:41:25 +03:00 by kerem · 3 comments
Owner

Originally created by @mpeteuil on GitHub (Oct 20, 2019).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/288

Describe the bug

After installing in editable mode on branch v0.4.3, running archivebox init results in an exception

django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

The directions I followed were basically these: https://github.com/pirate/ArchiveBox/wiki/Roadmap#-pip-install-archivebox

Steps to reproduce

  1. git clone https://github.com/pirate/ArchiveBox.git && cd ArchiveBox && git checkout v0.4.3
  2. pyenv local 3.7.4
  3. pipenv install && pipenv shell
  4. pip install -e .
  5. mkdir data && chmod 777 data && cd data
  6. archivebox init

After running the last step, I get the above error. At that point the ArchiveBox.conf file has already been created with something like:

[SERVER_CONFIG]
SECRET_KEY = abc123

Screenshots or log output

avatar-wan ArchiveBox # archivebox init
[+] Initializing a new ArchiveBox collection in this folder...
    /Users/mpeteuil/projects/ArchiveBox/data
------------------------------------------------------------------

[+] Building archive folder structure...
    √ /Users/mpeteuil/projects/ArchiveBox/data/sources
    √ /Users/mpeteuil/projects/ArchiveBox/data/archive
    √ /Users/mpeteuil/projects/ArchiveBox/data/logs
    √ /Users/mpeteuil/projects/ArchiveBox/data/ArchiveBox.conf

[+] Building main SQL index and running migrations...
Traceback (most recent call last):
  File "/Users/mpeteuil/.local/share/virtualenvs/ArchiveBox-GFvPTHwb-/Users/mpeteuil/.pyenv/shims/python/bin/archivebox", line 11, in <module>
    load_entry_point('archivebox', 'console_scripts', 'archivebox')()
  File "/Users/mpeteuil/projects/ArchiveBox/archivebox/__main__.py", line 10, in main
    archivebox.main(args=sys.argv[1:], stdin=sys.stdin)
  File "/Users/mpeteuil/projects/ArchiveBox/archivebox/cli/archivebox.py", line 58, in main
    pwd=pwd or OUTPUT_DIR,
  File "/Users/mpeteuil/projects/ArchiveBox/archivebox/cli/__init__.py", line 55, in run_subcommand
    module.main(args=subcommand_args, stdin=stdin, pwd=pwd)    # type: ignore
  File "/Users/mpeteuil/projects/ArchiveBox/archivebox/cli/archivebox_init.py", line 34, in main
    out_dir=pwd or OUTPUT_DIR,
  File "/Users/mpeteuil/projects/ArchiveBox/archivebox/util.py", line 105, in typechecked_function
    return func(*args, **kwargs)
  File "/Users/mpeteuil/projects/ArchiveBox/archivebox/main.py", line 293, in init
    setup_django(out_dir, check_db=False)
  File "/Users/mpeteuil/projects/ArchiveBox/archivebox/config/__init__.py", line 821, in setup_django
    django.setup()
  File "/Users/mpeteuil/.local/share/virtualenvs/ArchiveBox-GFvPTHwb-/Users/mpeteuil/.pyenv/shims/python/lib/python3.7/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/Users/mpeteuil/.local/share/virtualenvs/ArchiveBox-GFvPTHwb-/Users/mpeteuil/.pyenv/shims/python/lib/python3.7/site-packages/django/conf/__init__.py", line 79, in __getattr__
    self._setup(name)
  File "/Users/mpeteuil/.local/share/virtualenvs/ArchiveBox-GFvPTHwb-/Users/mpeteuil/.pyenv/shims/python/lib/python3.7/site-packages/django/conf/__init__.py", line 66, in _setup
    self._wrapped = Settings(settings_module)
  File "/Users/mpeteuil/.local/share/virtualenvs/ArchiveBox-GFvPTHwb-/Users/mpeteuil/.pyenv/shims/python/lib/python3.7/site-packages/django/conf/__init__.py", line 176, in __init__
    raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

Software versions

  • OS: MacOS 10.14.6
  • ArchiveBox version: 374dd39
  • Python version: 3.7.4
Originally created by @mpeteuil on GitHub (Oct 20, 2019). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/288 #### Describe the bug After installing in editable mode on branch `v0.4.3`, running `archivebox init` results in an exception > django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty. The directions I followed were basically these: https://github.com/pirate/ArchiveBox/wiki/Roadmap#-pip-install-archivebox #### Steps to reproduce 1. `git clone https://github.com/pirate/ArchiveBox.git && cd ArchiveBox && git checkout v0.4.3` 2. `pyenv local 3.7.4` 3. `pipenv install && pipenv shell` 4. `pip install -e .` 5. `mkdir data && chmod 777 data && cd data` 6. `archivebox init` After running the last step, I get the above error. At that point the `ArchiveBox.conf` file has already been created with something like: ```conf [SERVER_CONFIG] SECRET_KEY = abc123 ``` #### Screenshots or log output ```bash avatar-wan ArchiveBox # archivebox init [+] Initializing a new ArchiveBox collection in this folder... /Users/mpeteuil/projects/ArchiveBox/data ------------------------------------------------------------------ [+] Building archive folder structure... √ /Users/mpeteuil/projects/ArchiveBox/data/sources √ /Users/mpeteuil/projects/ArchiveBox/data/archive √ /Users/mpeteuil/projects/ArchiveBox/data/logs √ /Users/mpeteuil/projects/ArchiveBox/data/ArchiveBox.conf [+] Building main SQL index and running migrations... Traceback (most recent call last): File "/Users/mpeteuil/.local/share/virtualenvs/ArchiveBox-GFvPTHwb-/Users/mpeteuil/.pyenv/shims/python/bin/archivebox", line 11, in <module> load_entry_point('archivebox', 'console_scripts', 'archivebox')() File "/Users/mpeteuil/projects/ArchiveBox/archivebox/__main__.py", line 10, in main archivebox.main(args=sys.argv[1:], stdin=sys.stdin) File "/Users/mpeteuil/projects/ArchiveBox/archivebox/cli/archivebox.py", line 58, in main pwd=pwd or OUTPUT_DIR, File "/Users/mpeteuil/projects/ArchiveBox/archivebox/cli/__init__.py", line 55, in run_subcommand module.main(args=subcommand_args, stdin=stdin, pwd=pwd) # type: ignore File "/Users/mpeteuil/projects/ArchiveBox/archivebox/cli/archivebox_init.py", line 34, in main out_dir=pwd or OUTPUT_DIR, File "/Users/mpeteuil/projects/ArchiveBox/archivebox/util.py", line 105, in typechecked_function return func(*args, **kwargs) File "/Users/mpeteuil/projects/ArchiveBox/archivebox/main.py", line 293, in init setup_django(out_dir, check_db=False) File "/Users/mpeteuil/projects/ArchiveBox/archivebox/config/__init__.py", line 821, in setup_django django.setup() File "/Users/mpeteuil/.local/share/virtualenvs/ArchiveBox-GFvPTHwb-/Users/mpeteuil/.pyenv/shims/python/lib/python3.7/site-packages/django/__init__.py", line 19, in setup configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) File "/Users/mpeteuil/.local/share/virtualenvs/ArchiveBox-GFvPTHwb-/Users/mpeteuil/.pyenv/shims/python/lib/python3.7/site-packages/django/conf/__init__.py", line 79, in __getattr__ self._setup(name) File "/Users/mpeteuil/.local/share/virtualenvs/ArchiveBox-GFvPTHwb-/Users/mpeteuil/.pyenv/shims/python/lib/python3.7/site-packages/django/conf/__init__.py", line 66, in _setup self._wrapped = Settings(settings_module) File "/Users/mpeteuil/.local/share/virtualenvs/ArchiveBox-GFvPTHwb-/Users/mpeteuil/.pyenv/shims/python/lib/python3.7/site-packages/django/conf/__init__.py", line 176, in __init__ raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.") django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty. ``` #### Software versions - OS: `MacOS 10.14.6` - ArchiveBox version: `374dd39` - Python version: `3.7.4`
kerem closed this issue 2026-03-14 21:41:31 +03:00
Author
Owner

@pirate commented on GitHub (Oct 21, 2019):

Odd, does it work on the v0.4.0 branch? Thanks for reporting, it's probably a simple mistake I made somewhere like accidentally initializing django with setup_django before the config file is read.

<!-- gh-comment-id:544660978 --> @pirate commented on GitHub (Oct 21, 2019): Odd, does it work on the `v0.4.0` branch? Thanks for reporting, it's probably a simple mistake I made somewhere like accidentally initializing django with `setup_django` before the config file is read.
Author
Owner

@mpeteuil commented on GitHub (Oct 22, 2019):

Sure thing. Yes, it looks like the v0.4.0 branch works fine.

<!-- gh-comment-id:544766025 --> @mpeteuil commented on GitHub (Oct 22, 2019): Sure thing. Yes, it looks like the `v0.4.0` branch works fine.
Author
Owner

@pirate commented on GitHub (Jul 24, 2020):

This should be fixed on the latest django branch. If you still see any problems comment back here and I'll reopen the ticket.

<!-- gh-comment-id:663620303 --> @pirate commented on GitHub (Jul 24, 2020): This should be fixed on the latest `django` branch. If you still see any problems comment back here and I'll reopen the ticket.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#3226
No description provided.