Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nautobot-server runserver ignores -c option #5116

Closed
Phill93 opened this issue Jan 17, 2024 · 2 comments · Fixed by #5310
Closed

nautobot-server runserver ignores -c option #5116

Phill93 opened this issue Jan 17, 2024 · 2 comments · Fixed by #5310
Assignees
Labels
emergent Unplanned work that is brought into a sprint after it's started. type: bug Something isn't working as expected

Comments

@Phill93
Copy link

Phill93 commented Jan 17, 2024

Environment

  • Nautobot version (Docker tag too if applicable): 2.1.1
  • Python version: 3.10 on MacOS 13.6.2
  • Database platform, version: postgres 13
  • Middleware(s): None

Steps to Reproduce

  1. Setup Nautobot with poetry
  2. Migrate the database
  3. Start Nautobot with the command nautobot-server -c development/nautobot_config.py runserver

Expected Behavior

Running Nautobot

Observed Behavior

Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
January 17, 2024 - 12:27:25
Django version 3.2.23, using settings 'nautobot_config'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/USER/Library/Caches/pypoetry/virtualenvs/nautobot-jobs-ilJBC97m-py3.10/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/Users/USER/Library/Caches/pypoetry/virtualenvs/nautobot-jobs-ilJBC97m-py3.10/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 138, in inner_run
    handler = self.get_handler(*args, **options)
  File "/Users/USER/Library/Caches/pypoetry/virtualenvs/nautobot-jobs-ilJBC97m-py3.10/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/runserver.py", line 27, in get_handler
    handler = super().get_handler(*args, **options)
  File "/Users/USER/Library/Caches/pypoetry/virtualenvs/nautobot-jobs-ilJBC97m-py3.10/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 65, in get_handler
    return get_internal_wsgi_application()
  File "/Users/USER/Library/Caches/pypoetry/virtualenvs/nautobot-jobs-ilJBC97m-py3.10/lib/python3.10/site-packages/django/core/servers/basehttp.py", line 45, in get_internal_wsgi_application
    return import_string(app_path)
  File "/Users/USER/Library/Caches/pypoetry/virtualenvs/nautobot-jobs-ilJBC97m-py3.10/lib/python3.10/site-packages/django/utils/module_loading.py", line 17, in import_string
    module = import_module(module_path)
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/USER/Library/Caches/pypoetry/virtualenvs/nautobot-jobs-ilJBC97m-py3.10/lib/python3.10/site-packages/nautobot/core/wsgi.py", line 15, in <module>
    nautobot.setup()
  File "/Users/USER/Library/Caches/pypoetry/virtualenvs/nautobot-jobs-ilJBC97m-py3.10/lib/python3.10/site-packages/nautobot/__init__.py", line 32, in setup
    configure_app(
  File "/Users/USER/Library/Caches/pypoetry/virtualenvs/nautobot-jobs-ilJBC97m-py3.10/lib/python3.10/site-packages/nautobot/core/runner/runner.py", line 108, in configure_app
    raise ValueError(f"Configuration file does not exist at {config_path}")
ValueError: Configuration file does not exist at /Users/USER/.nautobot/nautobot_config.py
@Phill93 Phill93 added triage This issue is new and has not been reviewed. type: bug Something isn't working as expected labels Jan 17, 2024
@Phill93 Phill93 changed the title 'nautobot-server runserver' ignores -c option nautobot-server runserver ignores -c option Jan 17, 2024
@glennmatthews
Copy link
Contributor

Confirmed. Appears to be specific to the runserver command, as for example nautobot-server --config=development/nautobot_config.py nbshell works just fine.

I suspect the issue is that the configure_app() call in nautobot/__init__.py doesn't know or specify the config_path parameter, unlike the equivalent call in nautobot/core/runner/runner.py which does handle the --config CLI argument. But will need more investigation.

@gsnider2195 gsnider2195 removed the triage This issue is new and has not been reviewed. label Jan 31, 2024
@glennmatthews glennmatthews self-assigned this Feb 20, 2024
@glennmatthews glennmatthews added the emergent Unplanned work that is brought into a sprint after it's started. label Feb 21, 2024
@glennmatthews
Copy link
Contributor

Fixed by #5310.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emergent Unplanned work that is brought into a sprint after it's started. type: bug Something isn't working as expected
Projects
No open projects
Status: To Groom
Development

Successfully merging a pull request may close this issue.

3 participants