A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

693 views
Skip to first unread message

Iain Stewart

unread,
May 2, 2020, 10:43:51 AM5/2/20
to Django users
Hi Folks,

I am a learner and am enjoying learning Django so far (about a month in). I am doing the Mosh Python Tutorial for Begnniners on You Tube and in trying to save my first product on the Django admin/ products page and got the following error. I suspect the problem is between Django and SQLite. Any possible solution would be appreciated. Thanks!
Request Method: POST Request URL: http://127.0.0.1:8000/admin/products/product/add/ Django Version: 2.1 Python Version: 3.7.7 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'products.apps.ProductsConfig'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback: File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\utils.py" in _execute 85. return self.cursor.execute(sql, params) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py" in execute 296. return Database.Cursor.execute(self, query, params) The above exception (no such table: main.auth_user__old) was the direct cause of the following exception: File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\exception.py" in inner 34. response = get_response(request) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\base.py" in _get_response 126. response = self.process_exception_by_middleware(e, request) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\base.py" in _get_response 124. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\options.py" in wrapper 607. return self.admin_site.admin_view(view)(*args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\decorators.py" in _wrapped_view 142. response = view_func(request, *args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\views\decorators\cache.py" in _wrapped_view_func 44. response = view_func(request, *args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\sites.py" in inner 223. return view(request, *args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\options.py" in add_view 1647. return self.changeform_view(request, None, form_url, extra_context) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\decorators.py" in _wrapper 45. return bound_method(*args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\decorators.py" in _wrapped_view 142. response = view_func(request, *args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\options.py" in changeform_view 1536. return self._changeform_view(request, object_id, form_url, extra_context) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\options.py" in _changeform_view 1579. self.log_addition(request, new_object, change_message) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\options.py" in log_addition 813. change_message=message, File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\models.py" in log_action 35. change_message=change_message, File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\manager.py" in manager_method 82. return getattr(self.get_queryset(), name)(*args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\query.py" in create 413. obj.save(force_insert=True, using=self.db) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\base.py" in save 717. force_update=force_update, update_fields=update_fields) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\base.py" in save_base 747. updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\base.py" in _save_table 830. result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\base.py" in _do_insert 868. using=using, raw=raw) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\manager.py" in manager_method 82. return getattr(self.get_queryset(), name)(*args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\query.py" in _insert 1133. return query.get_compiler(using=using).execute_sql(return_id) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\sql\compiler.py" in execute_sql 1285. cursor.execute(sql, params) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\utils.py" in execute 100. return super().execute(sql, params) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\utils.py" in execute 68. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\utils.py" in _execute_with_wrappers 77. return executor(sql, params, many, context) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\utils.py" in _execute 85. return self.cursor.execute(sql, params) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\utils.py" in _exit_ 89. raise dj_exc_value.with_traceback(traceback) from exc_value File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\utils.py" in _execute 85. return self.cursor.execute(sql, params) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py" in execute 296. return Database.Cursor.execute(self, query, params) Exception Type: OperationalError at /admin/products/product/add/ Exception Value: no such table: main.auth_user__old

Jorge Gimeno

unread,
May 2, 2020, 1:34:03 PM5/2/20
to django...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b1f1de4b-8851-4b5a-b04d-58cad1bc1124%40googlegroups.com.

Have you run migrations yet?

-Jorge

Famzaa

unread,
May 2, 2020, 7:06:57 PM5/2/20
to django...@googlegroups.com
first run makemigrations and then migrate to create table if you see the model name in  admin section this means that the table is created sometimes this happens when you make changes to the model and don't run migrations.

Iain Stewart

unread,
May 3, 2020, 4:03:03 PM5/3/20
to Django users
Hi Jorge,

I have made migrations but the admin interface is not finding the database perhaps? I get this exception:

Exception Location:C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 296

Any help much appreciated.

Iain

On Saturday, 2 May 2020 18:34:03 UTC+1, jlgimeno71 wrote:


To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.

Iain Stewart

unread,
May 3, 2020, 4:03:22 PM5/3/20
to Django users
Hi Famzaa,

I have made migrations but the admin interface is not finding the database perhaps? I get this exception:

Exception Location:C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 296

Any help much appreciated.

Iain

To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.

Have you run migrations yet?

-Jorge

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.

Jorge Gimeno

unread,
May 3, 2020, 4:15:05 PM5/3/20
to django...@googlegroups.com
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dfeb6eb4-20ec-44fe-b872-e383afc6d24e%40googlegroups.com.

Would you be able to copy and paste the traceback, please?  It got cut off.

-Jorge

ia...@serenityscotland.co.uk

unread,
May 3, 2020, 5:40:12 PM5/3/20
to django...@googlegroups.com
Hi Jorge,

Here it is:

OperationalError at /admin/products/product/add/

no such table: main.auth_user__old
Request Method:POST
Request URL:http://127.0.0.1:8000/admin/products/product/add/
Django Version:2.1
Exception Type:OperationalError
Exception Value:
no such table: main.auth_user__old
Exception Location:
C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 296
Python Executable:C:\Users\user\PycharmProjects\JoanneShop\venv\Scripts\python.exe
Python Version:3.8.3
Python Path:
['C:\\Users\\user\\PycharmProjects\\JoanneShop',
 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python38\\python38.zip',
 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python38\\DLLs',
 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python38\\lib',
 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python38',
 'C:\\Users\\user\\PycharmProjects\\JoanneShop\\venv',
 'C:\\Users\\user\\PycharmProjects\\JoanneShop\\venv\\lib\\site-packages']
Server time:Sun, 3 May 2020 21:37:23 +0000

Traceback Switch to copy-and-paste view

  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\utils.py in _execute
    1.                 return self.cursor.execute(sql, params)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py in execute
  • The above exception (no such table: main.auth_user__old) was the direct cause of the following exception:

  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\core\handlers\exception.py in inner
    1.             response = get_response(request)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\core\handlers\base.py in _get_response
    1.                 response = self.process_exception_by_middleware(e, request)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\core\handlers\base.py in _get_response
    1.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)
    1. ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\contrib\admin\options.py in wrapper
    1.                 return self.admin_site.admin_view(view)(*args, **kwargs)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\utils\decorators.py in _wrapped_view
    1.                     response = view_func(request, *args, **kwargs)
    1. ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\views\decorators\cache.py in _wrapped_view_func
    1.         response = view_func(request, *args, **kwargs)
    1. ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\contrib\admin\sites.py in inner
    1.             return view(request, *args, **kwargs)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\contrib\admin\options.py in add_view
    1.         return self.changeform_view(request, None, form_url, extra_context)
    1. ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\utils\decorators.py in _wrapper
    1.         return bound_method(*args, **kwargs)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\utils\decorators.py in _wrapped_view
    1.                     response = view_func(request, *args, **kwargs)
    1. ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\contrib\admin\options.py in changeform_view
    1.             return self._changeform_view(request, object_id, form_url, extra_context)
    1. ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\contrib\admin\options.py in _changeform_view
    1.                     self.log_addition(request, new_object, change_message)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\contrib\admin\options.py in log_addition
    1.         return LogEntry.objects.log_action(
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\contrib\admin\models.py in log_action
    1.         return self.model.objects.create(
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\models\manager.py in manager_method
    1.                 return getattr(self.get_queryset(), name)(*args, **kwargs)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\models\query.py in create
    1.         obj.save(force_insert=True, using=self.db)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\models\base.py in save
    1.         self.save_base(using=using, force_insert=force_insert,
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\models\base.py in save_base
    1.             updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
    1. ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\models\base.py in _save_table
    1.             result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
    1. ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\models\base.py in _do_insert
    1.         return manager._insert([self], fields=fields, return_id=update_pk,
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\models\manager.py in manager_method
    1.                 return getattr(self.get_queryset(), name)(*args, **kwargs)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\models\query.py in _insert
    1.         return query.get_compiler(using=using).execute_sql(return_id)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\models\sql\compiler.py in execute_sql
    1.                 cursor.execute(sql, params)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\utils.py in execute
    1.             return super().execute(sql, params)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\utils.py in execute
    1.         return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
    1. ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\utils.py in _execute_with_wrappers
    1.         return executor(sql, params, many, context)
    1. ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\utils.py in _execute
    1.                 return self.cursor.execute(sql, params)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\utils.py in __exit__
    1.                 raise dj_exc_value.with_traceback(traceback) from exc_value
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\utils.py in _execute
    1.                 return self.cursor.execute(sql, params)
      ...
  • C:\Users\user\PycharmProjects\JoanneShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py in execute

Request information

USER

admin

GET

No GET data

POST

VariableValue
csrfmiddlewaretoken
'eYcrEdHbrMD4NM0JaQPNr0MTsBk5glC8a7fZ5KtlAv1zLSDUdxMOwEfMdRBGcNs4'
name
'Orange'
price
'1.99'
stock
'10'
image_url
'https://upload.wikimedia.org/wikipedia/commons/7/7b/Orange-Whole-%26-Split.jpg'
_save
'Save'

FILES

No FILES data

COOKIES

VariableValue
csrftoken
'YCaPUiPEp22AFbL2NS5TExwEXRDafrVyULdnlPBOyLq5DhodQz2UJbZxI7ULbTLu'
sessionid
'kc0wikeb8z3odgfunvee59eubqc2q503'

META

VariableValue
ALLUSERSPROFILE
'C:\\ProgramData'
APPDATA
'C:\\Users\\user\\AppData\\Roaming'
COMMONPROGRAMFILES
'C:\\Program Files\\Common Files'
COMMONPROGRAMFILES(X86)
'C:\\Program Files (x86)\\Common Files'
COMMONPROGRAMW6432
'C:\\Program Files\\Common Files'
COMPUTERNAME
'LAPTOP-SCFSKVQK'
COMSPEC
'C:\\WINDOWS\\system32\\cmd.exe'
CONTENT_LENGTH
'234'
CONTENT_TYPE
'application/x-www-form-urlencoded'
CSRF_COOKIE
'YCaPUiPEp22AFbL2NS5TExwEXRDafrVyULdnlPBOyLq5DhodQz2UJbZxI7ULbTLu'
DJANGO_SETTINGS_MODULE
'pyshop.settings'
DRIVERDATA
'C:\\Windows\\System32\\Drivers\\DriverData'
GATEWAY_INTERFACE
'CGI/1.1'
HOMEDRIVE
'C:'
HOMEPATH
'\\Users\\user'
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-US,en;q=0.9'
HTTP_CACHE_CONTROL
'max-age=0'
HTTP_CONNECTION
'keep-alive'
HTTP_COOKIE
('csrftoken=YCaPUiPEp22AFbL2NS5TExwEXRDafrVyULdnlPBOyLq5DhodQz2UJbZxI7ULbTLu; '
 'sessionid=kc0wikeb8z3odgfunvee59eubqc2q503')
HTTP_HOST
'127.0.0.1:8000'
HTTP_ORIGIN
'http://127.0.0.1:8000'
HTTP_REFERER
'http://127.0.0.1:8000/admin/products/product/add/'
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like '
 'Gecko) Chrome/81.0.4044.129 Safari/537.36')
IDEA_INITIAL_DIRECTORY
('C:\\Users\\user\\AppData\\Local\\JetBrains\\PyCharm Community Edition '
 '2020.1\\bin')
LOCALAPPDATA
'C:\\Users\\user\\AppData\\Local'
LOGONSERVER
'\\\\LAPTOP-SCFSKVQK'
NUMBER_OF_PROCESSORS
'4'
ONEDRIVE
'C:\\Users\\user\\OneDrive'
ONEDRIVECONSUMER
'C:\\Users\\user\\OneDrive'
ONLINESERVICES
'Online Services'
OS
'Windows_NT'
PATH
('C:\\Users\\user\\PycharmProjects\\JoanneShop\\venv\\Scripts;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program '
 'Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program '
 'Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files '
 '(x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program '
 'Files\\Intel\\Intel(R) Management Engine '
 'Components\\IPT;C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python38\\;C:\\Users\\user\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\user\\AppData\\Local\\Programs\\Microsoft '
 'VS Code\\bin;"%PyCharm Community '
 'Edition%;C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python38\\";')
PATHEXT
'.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
PATH_INFO
'/admin/products/product/add/'
PLATFORMCODE
'KV'
PROCESSOR_ARCHITECTURE
'AMD64'
PROCESSOR_IDENTIFIER
'Intel64 Family 6 Model 142 Stepping 9, GenuineIntel'
PROCESSOR_LEVEL
'6'
PROCESSOR_REVISION
'8e09'
PROGRAMDATA
'C:\\ProgramData'
PROGRAMFILES
'C:\\Program Files'
PROGRAMFILES(X86)
'C:\\Program Files (x86)'
PROGRAMW6432
'C:\\Program Files'
PROMPT
'(venv) $P$G'
PSMODULEPATH
('C:\\Program '
 'Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules')
PUBLIC
'C:\\Users\\Public'
PYCHARM COMMUNITY EDITION
('"C:\\Users\\user\\AppData\\Local\\JetBrains\\PyCharm Community Edition '
 '2020.1\\bin;C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python38\\";')
PYTHON_HOME
'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python38\\'
QUERY_STRING
''
REGIONCODE
'EMEA'
REMOTE_ADDR
'127.0.0.1'
REMOTE_HOST
''
REQUEST_METHOD
'POST'
RUN_MAIN
'true'
SCRIPT_NAME
''
SERVER_NAME
'LAPTOP-SCFSKVQK'
SERVER_PORT
'8000'
SERVER_PROTOCOL
'HTTP/1.1'
SERVER_SOFTWARE
'WSGIServer/0.2'
SESSIONNAME
'Console'
SYSTEMDRIVE
'C:'
SYSTEMROOT
'C:\\WINDOWS'
TEMP
'C:\\Users\\user\\AppData\\Local\\Temp'
TERMINAL_EMULATOR
'JetBrains-JediTerm'
TMP
'C:\\Users\\user\\AppData\\Local\\Temp'
USERDOMAIN
'LAPTOP-SCFSKVQK'
USERDOMAIN_ROAMINGPROFILE
'LAPTOP-SCFSKVQK'
USERNAME
'user'
USERPROFILE
'C:\\Users\\user'
VIRTUAL_ENV
'C:\\Users\\user\\PycharmProjects\\JoanneShop\\venv'
WINDIR
'C:\\WINDOWS'
_OLD_VIRTUAL_PATH
('C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program '
 'Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program '
 'Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files '
 '(x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program '
 'Files\\Intel\\Intel(R) Management Engine '
 'Components\\IPT;C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python38\\;C:\\Users\\user\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\user\\AppData\\Local\\Programs\\Microsoft '
 'VS Code\\bin;"%PyCharm Community '
 'Edition%;C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python38\\";')
_OLD_VIRTUAL_PROMPT
'$P$G'
__INTELLIJ_COMMAND_HISTFILE__
'C:\\Users\\user\\AppData\\Roaming\\JetBrains\\PyCharmCE2020.1\\terminal\\history\\history-61'
wsgi.errors
<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>
wsgi.file_wrapper
''
wsgi.input
<_io.BufferedReader name=1296>
wsgi.multiprocess
False
wsgi.multithread
True
wsgi.run_once
False
wsgi.url_scheme
'http'
wsgi.version
(1, 0)

Settings

Using settings module pyshop.settings

SettingValue
ABSOLUTE_URL_OVERRIDES
{}
ADMINS
[]
ALLOWED_HOSTS
[]
APPEND_SLASH
True
AUTHENTICATION_BACKENDS
['django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS
'********************'
AUTH_USER_MODEL
'auth.User'
BASE_DIR
'C:\\Users\\user\\PycharmProjects\\JoanneShop'
CACHES
{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS
'default'
CACHE_MIDDLEWARE_KEY_PREFIX
'********************'
CACHE_MIDDLEWARE_SECONDS
600
CSRF_COOKIE_AGE
31449600
CSRF_COOKIE_DOMAIN
None
CSRF_COOKIE_HTTPONLY
False
CSRF_COOKIE_NAME
'csrftoken'
CSRF_COOKIE_PATH
'/'
CSRF_COOKIE_SAMESITE
'Lax'
CSRF_COOKIE_SECURE
False
CSRF_FAILURE_VIEW
'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME
'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS
[]
CSRF_USE_SESSIONS
False
DATABASES
{'default': {'ATOMIC_REQUESTS': False,
             'AUTOCOMMIT': True,
             'CONN_MAX_AGE': 0,
             'ENGINE': 'django.db.backends.sqlite3',
             'HOST': '',
             'NAME': 'C:\\Users\\user\\PycharmProjects\\JoanneShop\\db.sqlite3',
             'OPTIONS': {},
             'PASSWORD': '********************',
             'PORT': '',
             'TEST': {'CHARSET': None,
                      'COLLATION': None,
                      'MIRROR': None,
                      'NAME': None},
             'TIME_ZONE': None,
             'USER': ''}}
DATABASE_ROUTERS
[]
DATA_UPLOAD_MAX_MEMORY_SIZE
2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS
1000
DATETIME_FORMAT
'N j, Y, P'
DATETIME_INPUT_FORMATS
['%Y-%m-%d %H:%M:%S',
 '%Y-%m-%d %H:%M:%S.%f',
 '%Y-%m-%d %H:%M',
 '%Y-%m-%d',
 '%m/%d/%Y %H:%M:%S',
 '%m/%d/%Y %H:%M:%S.%f',
 '%m/%d/%Y %H:%M',
 '%m/%d/%Y',
 '%m/%d/%y %H:%M:%S',
 '%m/%d/%y %H:%M:%S.%f',
 '%m/%d/%y %H:%M',
 '%m/%d/%y']
DATE_FORMAT
'N j, Y'
DATE_INPUT_FORMATS
['%Y-%m-%d',
 '%m/%d/%Y',
 '%m/%d/%y',
 '%b %d %Y',
 '%b %d, %Y',
 '%d %b %Y',
 '%d %b, %Y',
 '%B %d %Y',
 '%B %d, %Y',
 '%d %B %Y',
 '%d %B, %Y']
DEBUG
True
DEBUG_PROPAGATE_EXCEPTIONS
False
DECIMAL_SEPARATOR
'.'
DEFAULT_CHARSET
'utf-8'
DEFAULT_CONTENT_TYPE
'text/html'
DEFAULT_EXCEPTION_REPORTER_FILTER
'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE
'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL
'webmaster@localhost'
DEFAULT_INDEX_TABLESPACE
''
DEFAULT_TABLESPACE
''
DISALLOWED_USER_AGENTS
[]
EMAIL_BACKEND
'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST
'localhost'
EMAIL_HOST_PASSWORD
'********************'
EMAIL_HOST_USER
''
EMAIL_PORT
25
EMAIL_SSL_CERTFILE
None
EMAIL_SSL_KEYFILE
'********************'
EMAIL_SUBJECT_PREFIX
'[Django] '
EMAIL_TIMEOUT
None
EMAIL_USE_LOCALTIME
False
EMAIL_USE_SSL
False
EMAIL_USE_TLS
False
FILE_CHARSET
'utf-8'
FILE_UPLOAD_DIRECTORY_PERMISSIONS
None
FILE_UPLOAD_HANDLERS
['django.core.files.uploadhandler.MemoryFileUploadHandler',
 'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE
2621440
FILE_UPLOAD_PERMISSIONS
None
FILE_UPLOAD_TEMP_DIR
None
FIRST_DAY_OF_WEEK
0
FIXTURE_DIRS
[]
FORCE_SCRIPT_NAME
None
FORMAT_MODULE_PATH
None
FORM_RENDERER
'django.forms.renderers.DjangoTemplates'
IGNORABLE_404_URLS
[]
INSTALLED_APPS
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'products.apps.ProductsConfig']
INTERNAL_IPS
[]
LANGUAGES
[('af', 'Afrikaans'),
 ('ar', 'Arabic'),
 ('ast', 'Asturian'),
 ('az', 'Azerbaijani'),
 ('bg', 'Bulgarian'),
 ('be', 'Belarusian'),
 ('bn', 'Bengali'),
 ('br', 'Breton'),
 ('bs', 'Bosnian'),
 ('ca', 'Catalan'),
 ('cs', 'Czech'),
 ('cy', 'Welsh'),
 ('da', 'Danish'),
 ('de', 'German'),
 ('dsb', 'Lower Sorbian'),
 ('el', 'Greek'),
 ('en', 'English'),
 ('en-au', 'Australian English'),
 ('en-gb', 'British English'),
 ('eo', 'Esperanto'),
 ('es', 'Spanish'),
 ('es-ar', 'Argentinian Spanish'),
 ('es-co', 'Colombian Spanish'),
 ('es-mx', 'Mexican Spanish'),
 ('es-ni', 'Nicaraguan Spanish'),
 ('es-ve', 'Venezuelan Spanish'),
 ('et', 'Estonian'),
 ('eu', 'Basque'),
 ('fa', 'Persian'),
 ('fi', 'Finnish'),
 ('fr', 'French'),
 ('fy', 'Frisian'),
 ('ga', 'Irish'),
 ('gd', 'Scottish Gaelic'),
 ('gl', 'Galician'),
 ('he', 'Hebrew'),
 ('hi', 'Hindi'),
 ('hr', 'Croatian'),
 ('hsb', 'Upper Sorbian'),
 ('hu', 'Hungarian'),
 ('ia', 'Interlingua'),
 ('id', 'Indonesian'),
 ('io', 'Ido'),
 ('is', 'Icelandic'),
 ('it', 'Italian'),
 ('ja', 'Japanese'),
 ('ka', 'Georgian'),
 ('kab', 'Kabyle'),
 ('kk', 'Kazakh'),
 ('km', 'Khmer'),
 ('kn', 'Kannada'),
 ('ko', 'Korean'),
 ('lb', 'Luxembourgish'),
 ('lt', 'Lithuanian'),
 ('lv', 'Latvian'),
 ('mk', 'Macedonian'),
 ('ml', 'Malayalam'),
 ('mn', 'Mongolian'),
 ('mr', 'Marathi'),
 ('my', 'Burmese'),
 ('nb', 'Norwegian Bokmål'),
 ('ne', 'Nepali'),
 ('nl', 'Dutch'),
 ('nn', 'Norwegian Nynorsk'),
 ('os', 'Ossetic'),
 ('pa', 'Punjabi'),
 ('pl', 'Polish'),
 ('pt', 'Portuguese'),
 ('pt-br', 'Brazilian Portuguese'),
 ('ro', 'Romanian'),
 ('ru', 'Russian'),
 ('sk', 'Slovak'),
 ('sl', 'Slovenian'),
 ('sq', 'Albanian'),
 ('sr', 'Serbian'),
 ('sr-latn', 'Serbian Latin'),
 ('sv', 'Swedish'),
 ('sw', 'Swahili'),
 ('ta', 'Tamil'),
 ('te', 'Telugu'),
 ('th', 'Thai'),
 ('tr', 'Turkish'),
 ('tt', 'Tatar'),
 ('udm', 'Udmurt'),
 ('uk', 'Ukrainian'),
 ('ur', 'Urdu'),
 ('vi', 'Vietnamese'),
 ('zh-hans', 'Simplified Chinese'),
 ('zh-hant', 'Traditional Chinese')]
LANGUAGES_BIDI
['he', 'ar', 'fa', 'ur']
LANGUAGE_CODE
'en-us'
LANGUAGE_COOKIE_AGE
None
LANGUAGE_COOKIE_DOMAIN
None
LANGUAGE_COOKIE_NAME
'django_language'
LANGUAGE_COOKIE_PATH
'/'
LOCALE_PATHS
[]
LOGGING
{}
LOGGING_CONFIG
'logging.config.dictConfig'
LOGIN_REDIRECT_URL
'/accounts/profile/'
LOGIN_URL
'/accounts/login/'
LOGOUT_REDIRECT_URL
None
MANAGERS
[]
MEDIA_ROOT
''
MEDIA_URL
''
MESSAGE_STORAGE
'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']
MIGRATION_MODULES
{}
MONTH_DAY_FORMAT
'F j'
NUMBER_GROUPING
0
PASSWORD_HASHERS
'********************'
PASSWORD_RESET_TIMEOUT_DAYS
'********************'
PREPEND_WWW
False
ROOT_URLCONF
'pyshop.urls'
SECRET_KEY
'********************'
SECURE_BROWSER_XSS_FILTER
False
SECURE_CONTENT_TYPE_NOSNIFF
False
SECURE_HSTS_INCLUDE_SUBDOMAINS
False
SECURE_HSTS_PRELOAD
False
SECURE_HSTS_SECONDS
0
SECURE_PROXY_SSL_HEADER
None
SECURE_REDIRECT_EXEMPT
[]
SECURE_SSL_HOST
None
SECURE_SSL_REDIRECT
False
SERVER_EMAIL
'root@localhost'
SESSION_CACHE_ALIAS
'default'
SESSION_COOKIE_AGE
1209600
SESSION_COOKIE_DOMAIN
None
SESSION_COOKIE_HTTPONLY
True
SESSION_COOKIE_NAME
'sessionid'
SESSION_COOKIE_PATH
'/'
SESSION_COOKIE_SAMESITE
'Lax'
SESSION_COOKIE_SECURE
False
SESSION_ENGINE
'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE
False
SESSION_FILE_PATH
None
SESSION_SAVE_EVERY_REQUEST
False
SESSION_SERIALIZER
'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE
'pyshop.settings'
SHORT_DATETIME_FORMAT
'm/d/Y P'
SHORT_DATE_FORMAT
'm/d/Y'
SIGNING_BACKEND
'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS
[]
STATICFILES_DIRS
[]
STATICFILES_FINDERS
['django.contrib.staticfiles.finders.FileSystemFinder',
 'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE
'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT
None
STATIC_URL
'/static/'
TEMPLATES
[{'APP_DIRS': True,
  'BACKEND': 'django.template.backends.django.DjangoTemplates',
  'DIRS': [],
  'OPTIONS': {'context_processors': ['django.template.context_processors.debug',
                                     'django.template.context_processors.request',
                                     'django.contrib.auth.context_processors.auth',
                                     'django.contrib.messages.context_processors.messages']}}]
TEST_NON_SERIALIZED_APPS
[]
TEST_RUNNER
'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR
','
TIME_FORMAT
'P'
TIME_INPUT_FORMATS
['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE
'UTC'
USE_I18N
True
USE_L10N
True
USE_THOUSAND_SEPARATOR
False
USE_TZ
True
USE_X_FORWARDED_HOST
False
USE_X_FORWARDED_PORT
False
WSGI_APPLICATION
'pyshop.wsgi.application'
X_FRAME_OPTIONS
'SAMEORIGIN'
YEAR_MONTH_FORMAT
'F Y'

You're seein




--
 
Iain Stewart 
BA (U.C. Berkeley), MLitt with Distinction (University of Aberdeen) 
Tour Operator, Director and Guide

Serenity Scotland Ltd.
2b Priestfield Road
EDINBURGH EH16 5HH SCOTLAND

telephone: 0044 131 662 9123
mobile: 0044 7728 752824

  
Serenity Scotland Ltd. 2020 (trading since 2003)
Company No. SC 460598

Our VAT Registration Number is 317 0442 34 - VAT is accounted for using the Tour Operators Margin Scheme (TOMS)

a member of the Scottish Destination Management Association
please print this email only if entirely necessary


Jorge Gimeno

unread,
May 3, 2020, 5:47:19 PM5/3/20
to django...@googlegroups.com
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAAU1KRj%3DqG3oH5gF%2BSj8Q%2B4gdnKGx0y1nf0hm0MzzOC7usJ3g%40mail.gmail.com.

What version of Django are you running?

-Jorge

Jorge Gimeno

unread,
May 3, 2020, 5:48:29 PM5/3/20
to django...@googlegroups.com
I found a Stack Overflow question which seems relevant.  See here:  https://stackoverflow.com/questions/53637182/django-no-such-table-main-auth-user-old/

-Jorge

ia...@serenityscotland.co.uk

unread,
May 3, 2020, 5:53:55 PM5/3/20
to django...@googlegroups.com
Hi Jorge, 

I will try to fix  this tomorrow using the Stack answers. I will let you know how it goes.

Thanks so much! 

Iain

Adedotun Richard

unread,
May 3, 2020, 6:13:54 PM5/3/20
to django...@googlegroups.com
Can you paste your model.py class for products?
There is probability that you are getting the write-up wrong.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Motaz Hejaze

unread,
May 3, 2020, 6:33:01 PM5/3/20
to Django users
please share your models.py file

ia...@serenityscotland.co.uk

unread,
May 4, 2020, 3:03:03 AM5/4/20
to django...@googlegroups.com
Hi Folks, 

Here is models.py:

from django.db import models

class Product(models.Model):
name = models.CharField(max_length=255)
price = models.FloatField()
stock = models.IntegerField()
image_url = models.CharField(max_length=2083)


class Offer(models.Model):
code = models.CharField(max_length=10)
description = models.CharField(max_length=255)
discount = models.FloatField()

Thank you for any help!

Iain

Adedotun Richard

unread,
May 4, 2020, 8:17:58 AM5/4/20
to django...@googlegroups.com
Did you remember to add the models to the admin.py?

From .models import Product, Offer

admin.site.register(Product)
admin.site.register(Offer)


Govind Kumar Yadav

unread,
May 4, 2020, 8:33:34 AM5/4/20
to Django users
can you pls share how your admin.py file looks like


On Monday, 4 May 2020 12:33:03 UTC+5:30, ia...@serenityscotland.co.uk/webmail wrote:
Hi Folks, 

Here is models.py:

from django.db import models

class Product(models.Model):
name = models.CharField(max_length=255)
price = models.FloatField()
stock = models.IntegerField()
image_url = models.CharField(max_length=2083)


class Offer(models.Model):
code = models.CharField(max_length=10)
description = models.CharField(max_length=255)
discount = models.FloatField()

Thank you for any help!

Iain

On Sun, 3 May 2020 at 23:13, Adedotun Richard <dotun...@gmail.com> wrote:
Can you paste your model.py class for products?
There is probability that you are getting the write-up wrong.


On Sat, May 2, 2020, 3:43 PM Iain Stewart <iain.a...@gmail.com> wrote:
Hi Folks,

I am a learner and am enjoying learning Django so far (about a month in). I am doing the Mosh Python Tutorial for Begnniners on You Tube and in trying to save my first product on the Django admin/ products page and got the following error. I suspect the problem is between Django and SQLite. Any possible solution would be appreciated. Thanks!
Request Method: POST Request URL: http://127.0.0.1:8000/admin/products/product/add/ Django Version: 2.1 Python Version: 3.7.7 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'products.apps.ProductsConfig'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback: File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\utils.py" in _execute 85. return self.cursor.execute(sql, params) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py" in execute 296. return Database.Cursor.execute(self, query, params) The above exception (no such table: main.auth_user__old) was the direct cause of the following exception: File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\exception.py" in inner 34. response = get_response(request) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\base.py" in _get_response 126. response = self.process_exception_by_middleware(e, request) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\base.py" in _get_response 124. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\options.py" in wrapper 607. return self.admin_site.admin_view(view)(*args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\decorators.py" in _wrapped_view 142. response = view_func(request, *args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\views\decorators\cache.py" in _wrapped_view_func 44. response = view_func(request, *args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\sites.py" in inner 223. return view(request, *args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\options.py" in add_view 1647. return self.changeform_view(request, None, form_url, extra_context) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\decorators.py" in _wrapper 45. return bound_method(*args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\decorators.py" in _wrapped_view 142. response = view_func(request, *args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\options.py" in changeform_view 1536. return self._changeform_view(request, object_id, form_url, extra_context) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\options.py" in _changeform_view 1579. self.log_addition(request, new_object, change_message) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\options.py" in log_addition 813. change_message=message, File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\models.py" in log_action 35. change_message=change_message, File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\manager.py" in manager_method 82. return getattr(self.get_queryset(), name)(*args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\query.py" in create 413. obj.save(force_insert=True, using=self.db) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\base.py" in save 717. force_update=force_update, update_fields=update_fields) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\base.py" in save_base 747. updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\base.py" in _save_table 830. result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\base.py" in _do_insert 868. using=using, raw=raw) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\manager.py" in manager_method 82. return getattr(self.get_queryset(), name)(*args, **kwargs) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\query.py" in _insert 1133. return query.get_compiler(using=using).execute_sql(return_id) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\sql\compiler.py" in execute_sql 1285. cursor.execute(sql, params) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\utils.py" in execute 100. return super().execute(sql, params) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\utils.py" in execute 68. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\utils.py" in _execute_with_wrappers 77. return executor(sql, params, many, context) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\utils.py" in _execute 85. return self.cursor.execute(sql, params) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\utils.py" in _exit_ 89. raise dj_exc_value.with_traceback(traceback) from exc_value File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\utils.py" in _execute 85. return self.cursor.execute(sql, params) File "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py" in execute 296. return Database.Cursor.execute(self, query, params) Exception Type: OperationalError at /admin/products/product/add/ Exception Value: no such table: main.auth_user__old

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.

ia...@serenityscotland.co.uk

unread,
May 4, 2020, 8:40:00 AM5/4/20
to django...@googlegroups.com
I think so, from admin.py:

from django.contrib import admin
from .models import Product, Offer

admin.site.register(Product)
admin.site.register(Offer)

ia...@serenityscotland.co.uk

unread,
May 4, 2020, 8:40:48 AM5/4/20
to django...@googlegroups.com
Hi, here it is. Any help much appreciated.

 from admin.py:

from django.contrib import admin
from .models import Product, Offer

admin.site.register(Product)
admin.site.register(Offer)  
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dc1d236e-5362-447f-9ee8-e2043accf146%40googlegroups.com.

Sherif Adigun

unread,
May 4, 2020, 12:43:47 PM5/4/20
to Django users
Did you set up your project in a virtual environment??

If yes, always remember to runserver in the virtual environment

Iain Stewart

unread,
May 4, 2020, 1:05:38 PM5/4/20
to django...@googlegroups.com
I think I did it correctly in pycharm:

image.png

On Mon, 4 May 2020 at 17:43, Sherif Adigun <adigun...@gmail.com> wrote:
Did you set up your project in a virtual environment??

If yes, always remember to runserver in the virtual environment

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.


--
Iain Stewart
2b Priestfield Road
EDINBURGH EH16 5HH SCOTLAND

Iain Stewart

unread,
May 4, 2020, 1:06:19 PM5/4/20
to django...@googlegroups.com
and have run: python manage.py runserver

Nomeh Uchenna Gabriel

unread,
May 4, 2020, 2:30:54 PM5/4/20
to Django users
Hi! the reason is probably because you happened to have deleted "some but not all of your migrations"

... django will always look for the latest "sqlmigrate" with the versions in the right order(0001,0002,000x...) before it allows "makemigrations" add a new one.

To fix, this you must:

delete all your migration files located at "app_Name/migrations" then run

>>> py manage.py makemigrations [app_Name]


>>> py manage.py migrate [app_Name]

...you can skip app_Name if it's the only app in your project but I advise you add it anyway.

after that you can run:
>>> py manage.py sqlmigrate [app_Name]0001

if that shows your latest migrations, then it's done bro! your project should work now.

also check out your migrations and see how django added the new one.

where app_Name === your app name (the one that you added to 'installed_apps' of settings.py

Iain Stewart

unread,
May 4, 2020, 3:43:13 PM5/4/20
to django...@googlegroups.com
HI Nomeh,

Thanks for that. I have deleted the migration files, and made migrations again. Can you clarify exactly the python command:

py manage.py sqlmigrate [app_Name]0001 if my app is called products please as I am getting:

(venv) C:\Users\user\PycharmProjects\JoanneShop>py manage.py sqlmigrate products0001
usage: manage.py sqlmigrate [-h] [--database DATABASE] [--backwards] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH]
                            [--traceback] [--no-color]
                            app_label migration_name
manage.py sqlmigrate: error: the following arguments are required: migration_name

Thanks!

Iain
 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Iain Stewart

unread,
May 4, 2020, 3:47:11 PM5/4/20
to django...@googlegroups.com
worked it out, it is:   py manage.py sqlmigrate products 0001 but I am still not being able to connect into the database from django admin.

Iain Stewart

unread,
May 4, 2020, 3:53:34 PM5/4/20
to django...@googlegroups.com
that is still not working, thanks for all your help though, any other ideas appreciated. Could it be that I need an older version of sqlite as this Mosh tutorial was in 2018?

Iain

Adedotun Richard

unread,
May 4, 2020, 3:56:59 PM5/4/20
to django...@googlegroups.com
The only option now is to help you by  connecting to your system remotely and see the error messages and try to help you remotely. If that will help

Nomeh Uchenna Gabriel

unread,
May 6, 2020, 2:30:09 AM5/6/20
to Django users
delete the migrations again, then run this to reset the tracking:

>>> py manage.py migrate --fake [app_Name] zero

then redo the process I stated before.
... makemigrations [app_Name]
... migrate [app_Name]

Iain Stewart

unread,
May 6, 2020, 5:05:49 AM5/6/20
to django...@googlegroups.com
That has worked!! Thank you so much! 

And thank you to everyone who responded. 

As a learner I am so grateful to get through to the next step with this.

Iain :)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Nomeh Uchenna Gabriel

unread,
May 6, 2020, 2:07:32 PM5/6/20
to Django users
That's great to hear!

Matt D

unread,
May 29, 2020, 7:16:47 PM5/29/20
to Django users
Hello Iain,
 I am also working on Mosh's python tutorial and I'm having the same problems that you expressed in this chat. Did you delete the migrations through pycharm or through your computer to make it work?
Thanks

Iain Stewart

unread,
May 30, 2020, 4:17:15 AM5/30/20
to django...@googlegroups.com
Hi Matt,

I followed Nomeh's advice (the last email response to my question) which was to do this within the Pycharm console

delete the migrations again, then run this to reset the tracking:

so:

... py manage.py migrate --fake [app_Name] zero

then:
... py makemigrations [app_Name]
... py migrate [app_Name]  

That worked for me. 

Hope this helps!

Iain

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Matt D

unread,
May 30, 2020, 1:49:36 PM5/30/20
to Django users

^ Is this where you deleted the migrations?

I keep receiving this error when I enter py manage.py migrate products:

Iain Stewart

unread,
May 30, 2020, 3:35:56 PM5/30/20
to django...@googlegroups.com
Hi Matt.

Typing in to your pycharm console:

py manage.py migrate --fake [your_app_Name] zero  

where your_app_name is PyShop or whatever it is called, that should delete the previous migrations/ reset the tracking I think.

Iain

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages