Closed saattrupdan closed 4 years ago
You need to first create an admin username and password using:
python manage.py createsuperuser
You need to first create an admin username and password using:
python manage.py createsuperuser
I tried this and get the same error:
(.env) leidem@DansThinkpad:~/gitsky/charity_data/web_app/charity_app$ python manage.py createsuperuser
Traceback (most recent call last):
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 396, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: auth_user
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 79, in execute
return super().execute(*args, **options)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 100, in handle
default_username = get_default_username()
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/contrib/auth/management/__init__.py", line 140, in get_default_username
auth_app.User._default_manager.get(username=default_username)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/models/query.py", line 411, in get
num = len(clone)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/models/query.py", line 258, in __len__
self._fetch_all()
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/models/query.py", line 1261, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/models/query.py", line 57, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1151, in execute_sql
cursor.execute(sql, params)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/backends/utils.py", line 100, in execute
return super().execute(sql, params)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/backends/utils.py", line 68, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
File "/home/leidem/gitsky/charity_data/.env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 396, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: auth_user
You also need to apply migrations so that the database tables are updated:
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
Great, that worked. Thanks!
When I plug in a username and password in the app it gives me the following error.
Full trace:
GET Variable Value next
'/' POST Variable Value csrfmiddlewaretoken 'do2oZLiyaOqEQKX2cxgkiBoU53yq1ZghehaJK5nOb6JV8zLNOy2VOdITCGovSTyv' username
'test' password
'test' FILES No FILES data
Variable Value csrftoken
<_io.TextIOWrapper name=''bcZEPYMFLjTECaToMtQMYhZjl2ZQZQJMc57ZAiRVMBcVUZH9ouCnuTjiSFPVQK10' _xsrf
'2|240b8d8e|932620b930670b32e19414fe501ca0a1|1582488694' username-127-0-0-1-8888 '2|1:0|10:1582711000|23:username-127-0-0-1-8888|44:ZTAzNTc5ZTBjZGIwNGZkNDljYTEwYWZmNDE2YjMzNzA=|e53e5d4c17554ad0a92b404e84aff1d572dc8ff07f6d7e6e629946c7c6949441' META Variable Value CLUTTER_BACKEND 'x11' CLUTTER_IM_MODULE
'xim' COLORTERM
'truecolor' CONTENT_LENGTH
'112' CONTENT_TYPE
'application/x-www-form-urlencoded' CSRF_COOKIE 'bcZEPYMFLjTECaToMtQMYhZjl2ZQZQJMc57ZAiRVMBcVUZH9ouCnuTjiSFPVQK10' DBUS_SESSION_BUS_ADDRESS
'unix:path=/run/user/1000/bus' DEFAULTS_PATH
'/usr/share/gconf/xubuntu.default.path' DESKTOP_SESSION 'xubuntu' DISPLAY ':0.0' DJANGO_SETTINGS_MODULE
'charity_app.settings' GATEWAY_INTERFACE
'CGI/1.1' GDMSESSION
'xubuntu' GDM_LANG
'en_GB' GLADE_CATALOG_PATH
':' GLADE_MODULE_PATH
':' GLADE_PIXMAP_PATH
':' GPG_AGENT_INFO
'/run/user/1000/gnupg/S.gpg-agent:0:1' GTK_IM_MODULE
'xim' GTK_OVERLAY_SCROLLING
'0' HOME
'/home/leidem' HTTP_ACCEPT 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9' HTTP_ACCEPT_ENCODING
'gzip, deflate, br' HTTP_ACCEPT_LANGUAGE
'en-GB,en-US;q=0.9,en;q=0.8' HTTP_CACHE_CONTROL
'max-age=0' HTTP_CONNECTION 'keep-alive' HTTP_COOKIE ('csrftoken=bcZEPYMFLjTECaToMtQMYhZjl2ZQZQJMc57ZAiRVMBcVUZH9ouCnuTjiSFPVQK10; ' '_xsrf=2|240b8d8e|932620b930670b32e19414fe501ca0a1|1582488694; ' 'username-127-0-0-1-8888="2|1:0|10:1582711000|23:username-127-0-0-1-8888|44:ZTAzNTc5ZTBjZGIwNGZkNDljYTEwYWZmNDE2YjMzNzA=|e53e5d4c17554ad0a92b404e84aff1d572dc8ff07f6d7e6e629946c7c6949441"') HTTP_DNT
'1' HTTP_HOST
'127.0.0.1:8000' HTTP_ORIGIN 'http://127.0.0.1:8000' HTTP_REFERER
'http://127.0.0.1:8000/accounts/login/?next=/' HTTP_SEC_FETCH_DEST 'document' HTTP_SEC_FETCH_MODE 'navigate' HTTP_SEC_FETCH_SITE 'same-origin' HTTP_SEC_FETCH_USER '?1' HTTP_UPGRADE_INSECURE_REQUESTS
'1' HTTP_USER_AGENT ('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/80.0.3987.132 Safari/537.36') LANG
'en_GB.UTF-8' LANGUAGE
'en_GB:en' LC_ADDRESS
'en_GB.UTF-8' LC_IDENTIFICATION
'en_GB.UTF-8' LC_MEASUREMENT
'en_GB.UTF-8' LC_MONETARY 'en_GB.UTF-8' LC_NAME 'en_GB.UTF-8' LC_NUMERIC
'en_GB.UTF-8' LC_PAPER
'en_GB.UTF-8' LC_TELEPHONE
'en_GB.UTF-8' LC_TIME 'en_GB.UTF-8' LESSCLOSE
'/usr/bin/lesspipe %s %s' LESSOPEN
'| /usr/bin/lesspipe %s' LOGNAME 'leidem' LS_COLORS
'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.zst=01;31:.tzst=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.wim=01;31:.swm=01;31:.dwm=01;31:.esd=01;31:.jpg=01;35:.jpeg=01;35:.mjpg=01;35:.mjpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.m4a=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.oga=00;36:.opus=00;36:.spx=00;36:.xspf=00;36:' MANDATORY_PATH
'/usr/share/gconf/xubuntu.mandatory.path' OLDPWD
'/home/leidem/gitsky/charity_data/web_app' PAPERSIZE
'a4' PATH
'/home/leidem/gitsky/charity_data/.env/bin:/home/leidem/anaconda3/bin:/home/leidem/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin' PATH_INFO
'/accounts/login/' PS1 ('(.env) \[\e]0;\u@\h: ' '\w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ') PWD '/home/leidem/gitsky/charity_data' QT4_IM_MODULE
'xim' QT_ACCESSIBILITY
'1' QT_QPA_PLATFORMTHEME
'gtk2' QUERY_STRING
'next=/' REMOTE_ADDR '127.0.0.1' REMOTE_HOST '' REQUEST_METHOD
'POST' RUN_MAIN
'true' SCRIPT_NAME '' SERVER_NAME 'localhost' SERVER_PORT '8000' SERVER_PROTOCOL 'HTTP/1.1' SERVER_SOFTWARE 'WSGIServer/0.2' SESSION_MANAGER 'local/DansThinkpad:@/tmp/.ICE-unix/1660,unix/DansThinkpad:/tmp/.ICE-unix/1660' SHELL
'/bin/bash' SHLVL
'1' SSH_AGENT_PID
'1615' SSH_AUTH_SOCK
'/run/user/1000/keyring/ssh' TERM
'xterm-256color' TZ
'UTC' USER
'leidem' VIRTUAL_ENV '/home/leidem/gitsky/charity_data/.env' VTE_VERSION '5202' WINDOWID
'88080387' XAUTHORITY
'/home/leidem/.Xauthority' XDG_CONFIG_DIRS '/etc/xdg/xdg-xubuntu:/etc/xdg:/etc/xdg' XDG_CURRENT_DESKTOP 'XFCE' XDG_DATA_DIRS
'/usr/share/xubuntu:/usr/share/xfce4:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/var/lib/snapd/desktop:/usr/share' XDG_GREETER_DATA_DIR
'/var/lib/lightdm-data/leidem' XDG_MENU_PREFIX 'xfce-' XDG_RUNTIME_DIR '/run/user/1000' XDG_SEAT
'seat0' XDG_SEAT_PATH
'/org/freedesktop/DisplayManager/Seat0' XDG_SESSION_DESKTOP 'xubuntu' XDG_SESSION_ID
'c2' XDG_SESSION_PATH
'/org/freedesktop/DisplayManager/Session0' XDG_SESSION_TYPE
'x11' XDGVTNR
'7' XMODIFIERS
'@im=none'
'/home/leidem/gitsky/charity_data/.env/bin/python' wsgi.errors