python error when going through the installation

1,118 views
Skip to first unread message

joey c

unread,
Sep 11, 2018, 5:26:21 PM9/11/18
to NetBox
I'm not sure where i went wrong but i'm stuck on 

Run Database Migrations

Before NetBox can run, we need to install the database schema. This is done by running python3 manage.py migrate from the netbox directory (/opt/netbox/netbox/ in our example)

my output is:
[netboxadmin@netbox netbox]$ sudo python3 manage.py migrate
Traceback (most recent call last):
 
File "manage.py", line 10, in <module>
    execute_from_command_line
(sys.argv)
 
File "/usr/lib/python3.4/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility
.execute()
 
File "/usr/lib/python3.4/site-packages/django/core/management/__init__.py", line 317, in execute
    settings
.INSTALLED_APPS
 
File "/usr/lib/python3.4/site-packages/django/conf/__init__.py", line 56, in __getattr__
   
self._setup(name)
 
File "/usr/lib/python3.4/site-packages/django/conf/__init__.py", line 43, in _setup
   
self._wrapped = Settings(settings_module)
 
File "/usr/lib/python3.4/site-packages/django/conf/__init__.py", line 106, in __init__
    mod
= importlib.import_module(self.SETTINGS_MODULE)
 
File "/usr/lib64/python3.4/importlib/__init__.py", line 109, in import_module
   
return _bootstrap._gcd_import(name[level:], package, level)
 
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
 
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
 
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
 
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
 
File "<frozen importlib._bootstrap>", line 1129, in _exec
 
File "<frozen importlib._bootstrap>", line 1471, in exec_module
 
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
 
File "/opt/netbox-2.4.4/netbox/netbox/settings.py", line 11, in <module>
   
from netbox import configuration
 
File "/opt/netbox-2.4.4/netbox/netbox/configuration.py", line 11, in <module>
    ALLOWED_HOSTS
= [netbox.mycpmpanydomain.com]
NameError: name 'netbox' is not defined

I don't know anything about python i'm not sure what any of this means. I'm following the centos instructions in the guide. only thing i can think of is my username is netboxadmin. so its looking for something else?

Brian Candler

unread,
Sep 12, 2018, 2:57:49 AM9/12/18
to NetBox
The line containing the error is shown at the end of the backtrace.

The problem is that python strings must be enclosed in quotes.  That is, you should have put ALLOWED_HOSTS = ["netbox.mycpmpanydomain.com"]

joey c

unread,
Sep 12, 2018, 10:22:57 AM9/12/18
to NetBox
ok sorted that, but the command spits out a new error now:

[netboxadmin@netbox netbox]$ sudo python3 manage.py createsuperuser


You have 54 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, taggit, tenancy, users, virtualization.
Run 'python manage.py migrate' to apply them.



Traceback (most recent call last):

 
File "/usr/lib/python3.4/site-packages/django/db/backends/utils.py", line 85, in _execute
   
return self.cursor.execute(sql, params)
psycopg2
.ProgrammingError: relation "auth_user" does not exist
LINE
1: ...user"."is_active", "auth_user"."date_joined" FROM "auth_user...
                                                             
^




The above exception was the direct cause of the following exception:



Traceback (most recent call last):
 
File "manage.py", line 10, in <module>
    execute_from_command_line
(sys.argv)
 
File "/usr/lib/python3.4/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility
.execute()

 
File "/usr/lib/python3.4/site-packages/django/core/management/__init__.py", line 365, in execute
   
self.fetch_command(subcommand).run_from_argv(self.argv)
 
File "/usr/lib/python3.4/site-packages/django/core/management/base.py", line 288, in run_from_argv
   
self.execute(*args, **cmd_options)
 
File "/usr/lib/python3.4/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 59, in execute
   
return super().execute(*args, **options)
 
File "/usr/lib/python3.4/site-packages/django/core/management/base.py", line 335, in execute
    output
= self.handle(*args, **options)
 
File "/usr/lib/python3.4/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 92, in handle
    default_username
= get_default_username()
 
File "/usr/lib/python3.4/site-packages/django/contrib/auth/management/__init__.py", line 136, in get_default_username
    auth_app
.User._default_manager.get(username=default_username)
 
File "/usr/lib/python3.4/site-packages/django/db/models/manager.py", line 82, in manager_method
   
return getattr(self.get_queryset(), name)(*args, **kwargs)
 
File "/usr/lib/python3.4/site-packages/django/db/models/query.py", line 397, in get
    num
= len(clone)
 
File "/usr/lib/python3.4/site-packages/django/db/models/query.py", line 254, in __len__
   
self._fetch_all()
 
File "/usr/lib/python3.4/site-packages/django/db/models/query.py", line 1179, in _fetch_all
   
self._result_cache = list(self._iterable_class(self))
 
File "/usr/lib/python3.4/site-packages/django/db/models/query.py", line 53, in __iter__
    results
= compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
 
File "/usr/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 1068, in execute_sql
    cursor
.execute(sql, params)
 
File "/usr/lib/python3.4/site-packages/django/db/backends/utils.py", line 68, in execute
   
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
 
File "/usr/lib/python3.4/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
   
return executor(sql, params, many, context)
 
File "/usr/lib/python3.4/site-packages/django/db/backends/utils.py", line 85, in _execute
   
return self.cursor.execute(sql, params)
 
File "/usr/lib/python3.4/site-packages/django/db/utils.py", line 89, in __exit__
   
raise dj_exc_value.with_traceback(traceback) from exc_value
 
File "/usr/lib/python3.4/site-packages/django/db/backends/utils.py", line 85, in _execute
   
return self.cursor.execute(sql, params)
django
.db.utils.ProgrammingError: relation "auth_user" does not exist
LINE
1: ...user"."is_active", "auth_user"."date_joined" FROM "auth_user...


apparently i'm missing a user account?

joey c

unread,
Sep 12, 2018, 1:00:50 PM9/12/18
to NetBox
nevermind i totally skipped the migration step. we're all good now, thanks!
Reply all
Reply to author
Forward
0 new messages