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

Development: nautobot-server run server does not work using poetry run #26

Closed
jathanism opened this issue Feb 24, 2021 · 3 comments · Fixed by #46 or #196
Closed

Development: nautobot-server run server does not work using poetry run #26

jathanism opened this issue Feb 24, 2021 · 3 comments · Fixed by #46 or #196
Assignees
Labels
type: bug Something isn't working as expected
Milestone

Comments

@jathanism
Copy link
Contributor

Environment

  • Python version:
  • Nautobot version: 1.0.0a2

Steps to Reproduce

  1. Install nautobot using poetry install
  2. Try to run poetry run nautobot-server runserver 0.0.0.0:8000

Expected Behavior

Dev server should start.

Observed Behavior

$ poetry run nautobot-server runserver 0.0.0.0:8000 --insecure
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/jathan/sandbox/src/nautobot/nautobot/core/cli.py", line 55, in main
    run_app(
  File "/Users/jathan/sandbox/src/nautobot/nautobot/core/runner/runner.py", line 268, in run_app
    management.execute_from_command_line([runner_name, command] + command_args)
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.9/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.9/lib/python3.9/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.9/lib/python3.9/site-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.9/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 61, in execute
    super().execute(*args, **options)
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.9/lib/python3.9/site-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.9/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 96, in handle
    self.run(**options)
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.9/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 103, in run
    autoreload.run_with_reloader(self.inner_run, **options)
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.9/lib/python3.9/site-packages/django/utils/autoreload.py", line 620, in run_with_reloader
    exit_code = restart_with_reloader()
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.9/lib/python3.9/site-packages/django/utils/autoreload.py", line 246, in restart_with_reloader
    args = get_child_arguments()
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.9/lib/python3.9/site-packages/django/utils/autoreload.py", line 233, in get_child_arguments
    raise RuntimeError('Script %s does not exist.' % py_script)
RuntimeError: Script nautobot-server does not exist.

If I run poetry shell first to enter the virtualenv and then follow that with nautobot-server ... it works as expected.

$ poetry shell
Spawning shell within /Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.9

$ . /Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.9/bin/activate

$ nautobot-server runserver 0.0.0.0:8000 --insecure
Performing system checks...

System check identified no issues (0 silenced).
February 24, 2021 - 18:59:51
Django version 3.1.7, using settings 'nautobot_config'
Starting development server at http://0.0.0.0:6789/
Quit the server with CONTROL-C.
nautobot     INFO     Nautobot initialized!
@jathanism jathanism added the type: bug Something isn't working as expected label Feb 24, 2021
@jathanism jathanism added this to the v1.0.0 milestone Feb 26, 2021
@jathanism
Copy link
Contributor Author

Hmm this was not yet fixed. I think I must have tagged the wrong ticket.

@jathanism jathanism reopened this Mar 5, 2021
glennmatthews added a commit that referenced this issue Mar 5, 2021
glennmatthews added a commit that referenced this issue Mar 5, 2021
* Add release notes in preparation for 1.0.0b2 release

* #26 is not actually fixed yet
@jathanism
Copy link
Contributor Author

jathanism commented Mar 19, 2021

The root cause for this is when it attempts to use the auto-reload functionality, it fails because it can't find the root path of the script and determine the files needed to reload on change.

If you pass the --noreload flag, it works:

$ poetry run nautobot-server runserver 0.0.0.0:8000 --insecure --noreload
Performing system checks...

System check identified no issues (0 silenced).
March 19, 2021 - 21:52:21
Django version 3.1.7, using settings 'nautobot_config'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.```

@jathanism
Copy link
Contributor Author

Related Poetry issue: python-poetry/poetry#2435

@jathanism jathanism added this to To do in Release v1.0.0 Mar 24, 2021
jathanism added a commit to jathanism/nautobot that referenced this issue Mar 25, 2021
- Explain dangers of production use in more detail
- Explain why `poetry run nautobot-server runserver` should not be used
@jathanism jathanism moved this from To do to In progress in Release v1.0.0 Mar 25, 2021
Release v1.0.0 automation moved this from In progress to Done Mar 25, 2021
jathanism added a commit that referenced this issue Mar 25, 2021
- Explain dangers of production use in more detail
- Explain why `poetry run nautobot-server runserver` should not be used
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
No open projects
1 participant