Django Suspicious Operation Request Session deleted - django

I try to get my django page running on my server and stumble upon the following error message in my browser:
SuspiciousOperation at /lfp/filter/
The request's session was deleted before the request completed. The
user may have logged out in a concurrent request, for example.
The traceback you can find here:
Environment:
Request Method: GET
Request URL: http://localhost/pass/lfp/filter/
Django Version: 1.11.2
Python Version: 3.6.1
Installed Applications:
['django_tables2',
'pass_list.apps.PassListConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
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 "/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
65. return self.cursor.execute(sql, params)
File "/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py" in execute
328. return Database.Cursor.execute(self, query, params)
The above exception (attempt to write a readonly database) was the direct cause of the following exception:
File "/lib/python3.6/site-packages/django/contrib/sessions/backends/db.py" in save
87. obj.save(force_insert=must_create, force_update=not must_create, using=using)
File "/lib/python3.6/site-packages/django/db/models/base.py" in save
806. force_update=force_update, update_fields=update_fields)
File "/lib/python3.6/site-packages/django/db/models/base.py" in save_base
836. updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/lib/python3.6/site-packages/django/db/models/base.py" in _save_table
903. forced_update)
File "/lib/python3.6/site-packages/django/db/models/base.py" in _do_update
953. return filtered._update(values) > 0
File "/lib/python3.6/site-packages/django/db/models/query.py" in _update
664. return query.get_compiler(self.db).execute_sql(CURSOR)
File "/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in execute_sql
1191. cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File "/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in execute_sql
886. raise original_exception
File "/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in execute_sql
876. cursor.execute(sql, params)
File "/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
80. return super(CursorDebugWrapper, self).execute(sql, params)
File "/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
65. return self.cursor.execute(sql, params)
File "/lib/python3.6/site-packages/django/db/utils.py" in __exit__
94. six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/lib/python3.6/site-packages/django/utils/six.py" in reraise
685. raise value.with_traceback(tb)
File "/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
65. return self.cursor.execute(sql, params)
File "/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py" in execute
328. return Database.Cursor.execute(self, query, params)
During handling of the above exception (attempt to write a readonly database), another exception occurred:
File "/lib/python3.6/site-packages/django/contrib/sessions/middleware.py" in process_response
58. request.session.save()
File "/lib/python3.6/site-packages/django/contrib/sessions/backends/db.py" in save
94. raise UpdateError
During handling of the above exception (), another exception occurred:
File "/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/lib/python3.6/site-packages/django/utils/deprecation.py" in __call__
142. response = self.process_response(request, response)
File "/lib/python3.6/site-packages/django/contrib/sessions/middleware.py" in process_response
61. "The request's session was deleted before the "
Exception Type: SuspiciousOperation at /lfp/filter/
Exception Value: The request's session was deleted before the request completed. The user may have logged out in a concurrent request, for example.
How can I solve that issue?

I solved my problem. It was a problem with the access management. The file db.sqlite3 was just readable. Changing the rights solved my problem.

Related

Attempt to write a readonly SQLite database in Django

I have implemented my simple Django applications on server, but my forms for users can not save anything.
My database settings looks like this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
My error which template receives looks like this:
nvironment:
Request Method: POST
Request URL: http://68.183.76.239/wyniki-wyszukiwania/konta-bankowe/
Django Version: 2.2.2
Python Version: 3.5.2
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'app',
'django_filters',
'crispy_forms',
'django_select2']
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 "/home/app/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute
84. return self.cursor.execute(sql, params)
File "/home/app/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py" in execute
383. return Database.Cursor.execute(self, query, params)
The above exception (attempt to write a readonly database) was the direct cause of the following exception:
File "/home/app/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)
File "/home/app/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
115. response = self.process_exception_by_middleware(e, request)
File "/home/app/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
113. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/app/app/app/views.py" in search_results_account
149. product_broken_form.save()
File "/home/app/lib/python3.5/site-packages/django/forms/models.py" in save
458. self.instance.save()
File "/home/app/lib/python3.5/site-packages/django/db/models/base.py" in save
741. force_update=force_update, update_fields=update_fields)
File "/home/app/lib/python3.5/site-packages/django/db/models/base.py" in save_base
779. force_update, using, update_fields,
File "/home/app/lib/python3.5/site-packages/django/db/models/base.py" in _save_table
870. result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/home/app/lib/python3.5/site-packages/django/db/models/base.py" in _do_insert
908. using=using, raw=raw)
File "/home/app/lib/python3.5/site-packages/django/db/models/manager.py" in manager_method
82. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/app/lib/python3.5/site-packages/django/db/models/query.py" in _insert
1186. return query.get_compiler(using=using).execute_sql(return_id)
File "/home/app/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
1335. cursor.execute(sql, params)
File "/home/app/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
99. return super().execute(sql, params)
File "/home/app/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
67. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/home/app/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute_with_wrappers
76. return executor(sql, params, many, context)
File "/home/app/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute
84. return self.cursor.execute(sql, params)
File "/home/app/lib/python3.5/site-packages/django/db/utils.py" in __exit__
89. raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/app/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute
84. return self.cursor.execute(sql, params)
File "/home/app/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py" in execute
383. return Database.Cursor.execute(self, query, params)
Exception Type: OperationalError at /wyniki-wyszukiwania/konta-bankowe/
Exception Value: attempt to write a readonly database
How can I add changes to get rid of an error? I found similar answers on Stack Overflow, but I did not find information on how to allow everyone to write changes to SQLite (to make the error disappear).
The first place that I would look for is whether or not the user who is running the Django app has write permissions on db.sqlite file.

Programming Error: "user_id of relation APP_MODEL does not exist"

I've set User as a foreign key on my Video model. I am using the default django auth User model, and have managed to create a user using the serializer and view that I set up for it. The problem is that whenever I try to create a video entry I hit the title error.
I've tried clearing the database, redoing the migrations, but there aren't any migrations for the app that handles the user serializer.
The Model
from django.contrib.auth.models import User
class Video(models.Model):
user = models.ForeignKey(
User,
on_delete=models.CASCADE,
null=True
)
map_marker = models.ForeignKey(MapMarker, on_delete=models.CASCADE)
created = models.DateTimeField()
ip_addr = models.TextField()
file_id = models.TextField()
class Meta:
ordering = ('created',)
Full traceback:
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/videos/
Django Version: 2.2.1
Python Version: 3.7.2
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'userbase',
'trickspot',
'profanity']
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\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\backends\utils.py" in _execute
84. return self.cursor.execute(sql, params)
The above exception (column "user_id" of relation "trickspot_video" does not exist
LINE 1: INSERT INTO "trickspot_video" ("user_id", "map_marker_id", "...
^
) was the direct cause of the following exception:
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\core\handlers\exception.py" in inner
34. response = get_response(request)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\core\handlers\base.py" in _get_response
115. response = self.process_exception_by_middleware(e, request)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\core\handlers\base.py" in _get_response
113. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\views\decorators\csrf.py" in wrapped_view
54. return view_func(*args, **kwargs)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\rest_framework\viewsets.py" in view
116. return self.dispatch(request, *args, **kwargs)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\rest_framework\views.py" in dispatch
495. response = self.handle_exception(exc)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\rest_framework\views.py" in handle_exception
455. self.raise_uncaught_exception(exc)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\rest_framework\views.py" in dispatch
492. response = handler(request, *args, **kwargs)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\rest_framework\mixins.py" in create
21. self.perform_create(serializer)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\rest_framework\mixins.py" in perform_create
26. serializer.save()
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\rest_framework\serializers.py" in save
214. self.instance = self.create(validated_data)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\rest_framework\serializers.py" in create
943. instance = ModelClass._default_manager.create(**validated_data)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\models\manager.py" in manager_method
82. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\models\query.py" in create
422. obj.save(force_insert=True, using=self.db)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\models\base.py" in save
741. force_update=force_update, update_fields=update_fields)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\models\base.py" in save_base
779. force_update, using, update_fields,
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\models\base.py" in _save_table
870. result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\models\base.py" in _do_insert
908. using=using, raw=raw)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\models\manager.py" in manager_method
82. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\models\query.py" in _insert
1186. return query.get_compiler(using=using).execute_sql(return_id)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\models\sql\compiler.py" in execute_sql
1335. cursor.execute(sql, params)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\backends\utils.py" in execute
99. return super().execute(sql, params)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\backends\utils.py" in execute
67. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\backends\utils.py" in _execute_with_wrappers
76. return executor(sql, params, many, context)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\backends\utils.py" in _execute
84. return self.cursor.execute(sql, params)
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\utils.py" in __exit__
89. raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\Zeph\.virtualenvs\SK8M8_API-LRdA6z3-\lib\site-packages\django\db\backends\utils.py" in _execute
84. return self.cursor.execute(sql, params)
Exception Type: ProgrammingError at /videos/
Exception Value: column "user_id" of relation "trickspot_video" does not exist
LINE 1: INSERT INTO "trickspot_video" ("user_id", "map_marker_id", "...
^
The entry should be saved with the key of the user I selected on the API view.
Something got broken along the way and dropping the DB and starting again fixed the problem.
Thanks

Django column wagtailcore_page.draft_title does not exist

Django==1.11.3, wagtail==1.11.1
I did a backup of my PostgreSQL on remote server and did a restore on my local server so I can get an exact copy of all the changes. I've done it this way for a long long time and its always worked like a charm. But this time, I did the restore and got the error below:
column wagtailcore_page.draft_title does not exist
LINE 1: ...ore_page"."numchild", "wagtailcore_page"."title", "wagtailco...
I deleted my database and restored fresh but that did nothing. I deleted all migrations, did the --fake migration to try and reset, but nothing; still getting the error. I am at a loss on this one and could use some feedback. Thank you.
Here's my trace file:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8001/
Django Version: 1.11.3
Python Version: 3.5.0
Installed Applications:
['app',
'home',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django_summernote',
'rest_framework',
'wagtail.contrib.settings',
'wagtail.contrib.modeladmin',
'wagtail.wagtailcore',
'wagtail.wagtailadmin',
'wagtail.wagtaildocs',
'wagtail.wagtailsnippets',
'wagtail.wagtailusers',
'wagtail.wagtailimages',
'wagtail.wagtailembeds',
'wagtail.wagtailsearch',
'wagtail.wagtailsites',
'wagtail.wagtailredirects',
'wagtail.wagtailforms',
'wagtail.contrib.wagtailsitemaps',
'wagtail.contrib.wagtailroutablepage',
'wagtail.contrib.wagtailstyleguide',
'wagtailmenus',
'compressor',
'taggit',
'modelcluster',
'docs',
'wagtail.contrib.table_block']
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.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'wagtail.wagtailcore.middleware.SiteMiddleware',
'wagtail.wagtailredirects.middleware.RedirectMiddleware']
Traceback:
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
65. return self.cursor.execute(sql, params)
The above exception (column wagtailcore_page.draft_title does not exist
LINE 1: ...ore_page"."numchild", "wagtailcore_page"."title", "wagtailco...
^
) was the direct cause of the following exception:
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/core/handlers/base.py" in _legacy_get_response
244. response = middleware_method(request)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailcore/middleware.py" in process_request
20. request.site = Site.find_for_request(request)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailcore/models.py" in find_for_request
129. return get_site_for_hostname(hostname, port)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailcore/sites.py" in get_site_for_hostname
38. 'root_page'
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/query.py" in __iter__
250. self._fetch_all()
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/query.py" in _fetch_all
1118. self._result_cache = list(self._iterable_class(self))
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/query.py" in __iter__
53. results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
886. raise original_exception
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
876. cursor.execute(sql, params)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
80. return super(CursorDebugWrapper, self).execute(sql, params)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
65. return self.cursor.execute(sql, params)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/utils.py" in __exit__
94. six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/utils/six.py" in reraise
685. raise value.with_traceback(tb)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
65. return self.cursor.execute(sql, params)
Exception Type: ProgrammingError at /
Exception Value: column wagtailcore_page.draft_title does not exist
LINE 1: ...ore_page"."numchild", "wagtailcore_page"."title", "wagtailco...
^
the error is due to the fact that you have not migrated the newest version of wagtail. just run python manage.py migrate and when you see it running, this will appear:
Running migrations:
Rendering model states ... DONE
Applying
wagtailcore.0040_page_draft_title
... OK
rerun your project and you're done.
After restoring your database backup, you need to run ./manage.py migrate. draft_title was added in Wagtail 1.11, so presumably your backup is from a site running Wagtail 1.10 or earlier.
(Running --fake is the opposite of what you want... it tells Django not to run any of the outstanding migrations, including the one that adds the draft_title column.)

Django Wagail error: column wagtailusers_userprofile.preferred_language does not exist

I upgraded Wagtail to version 1.10.1 and now when I try to log into admin I get column wagtailusers_userprofile.preferred_language does not exist error. The error seems obvious, but I am not sure how to fix it; I assumed the Wagtail upgrade would have handled it. Below is the traceback. Thank you.
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8001/admin/
Django Version: 1.11.2
Python Version: 3.5.0
Installed Applications:
['app',
'home',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django_summernote',
'rest_framework',
'wagtail.contrib.settings',
'wagtail.contrib.modeladmin',
'wagtail.wagtailcore',
'wagtail.wagtailadmin',
'wagtail.wagtaildocs',
'wagtail.wagtailsnippets',
'wagtail.wagtailusers',
'wagtail.wagtailimages',
'wagtail.wagtailembeds',
'wagtail.wagtailsearch',
'wagtail.wagtailsites',
'wagtail.wagtailredirects',
'wagtail.wagtailforms',
'wagtail.contrib.wagtailsitemaps',
'wagtail.contrib.wagtailroutablepage',
'wagtail.contrib.wagtailstyleguide',
'wagtailmenus',
'compressor',
'taggit',
'modelcluster',
'docs']
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.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'wagtail.wagtailcore.middleware.SiteMiddleware',
'wagtail.wagtailredirects.middleware.RedirectMiddleware']
Traceback:
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/fields/related_descriptors.py" in __get__
385. rel_obj = getattr(instance, self.cache_name)
During handling of the above exception ('User' object has no attribute '_wagtail_userprofile_cache'), another exception occurred:
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
65. return self.cursor.execute(sql, params)
The above exception (column wagtailusers_userprofile.preferred_language does not exist
LINE 1: ...gtailusers_userprofile"."rejected_notifications", "wagtailus...
^
) was the direct cause of the following exception:
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/core/handlers/base.py" in _legacy_get_response
249. response = self._get_response(request)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/views/decorators/cache.py" in _cache_controlled
43. response = viewfunc(request, *args, **kw)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailadmin/decorators.py" in decorated_view
25. if hasattr(user, 'wagtail_userprofile'):
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/utils/functional.py" in inner
239. return func(self._wrapped, *args)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/fields/related_descriptors.py" in __get__
393. rel_obj = self.get_queryset(instance=instance).get(**filter_args)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/query.py" in get
374. num = len(clone)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/query.py" in __len__
232. self._fetch_all()
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/query.py" in _fetch_all
1105. self._result_cache = list(self._iterable_class(self))
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/query.py" in __iter__
53. results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
886. raise original_exception
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
876. cursor.execute(sql, params)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
80. return super(CursorDebugWrapper, self).execute(sql, params)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
65. return self.cursor.execute(sql, params)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/utils.py" in __exit__
94. six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/utils/six.py" in reraise
685. raise value.with_traceback(tb)
File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
65. return self.cursor.execute(sql, params)
Exception Type: ProgrammingError at /admin/
Exception Value: column wagtailusers_userprofile.preferred_language does not exist
LINE 1: ...gtailusers_userprofile"."rejected_notifications", "wagtailus...
You need to run ./manage.py migrate.

Django::OperationalError at /admin/login/ unable to open database file

I know there's already a same question, i too tried the solutions given their but it dint work for me hence i am writing my own question.
Hii all, i am deploying django server using apache2 server and when i tried my host Ip address it works fine as it displays it Worked page, it works for IPADRESS/admin also but after filling in the credentials and hit on enter will produce this error
***OperationalError at /admin/login/
unable to open database file***
and my error looks like
Environment:
Request Method: POST
Request URL: http://192.168.1.105/admin/login/?next=/admin/
Django Version: 1.7.4
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'managementdashboard')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback:
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
111. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
52. response = view_func(request, *args, **kwargs)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/contrib/admin/sites.py" in login
361. return login(request, **defaults)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/views/decorators/debug.py" in sensitive_post_parameters_wrapper
76. return view(request, *args, **kwargs)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
105. response = view_func(request, *args, **kwargs)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
52. response = view_func(request, *args, **kwargs)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/contrib/auth/views.py" in login
44. auth_login(request, form.get_user())
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/contrib/auth/__init__.py" in login
96. request.session.cycle_key()
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py" in cycle_key
279. self.create()
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/contrib/sessions/backends/db.py" in create
41. self.save(must_create=True)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/contrib/sessions/backends/db.py" in save
64. obj.save(force_insert=must_create, using=using)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/db/models/base.py" in save
589. force_update=force_update, update_fields=update_fields)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/db/models/base.py" in save_base
617. updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/db/models/base.py" in _save_table
698. result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/db/models/base.py" in _do_insert
731. using=using, raw=raw)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/db/models/manager.py" in manager_method
92. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/db/models/query.py" in _insert
921. return query.get_compiler(using=using).execute_sql(return_id)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
920. cursor.execute(sql, params)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
81. return super(CursorDebugWrapper, self).execute(sql, params)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
65. return self.cursor.execute(sql, params)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/db/utils.py" in __exit__
94. six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
65. return self.cursor.execute(sql, params)
File "/var/www/dashboardapp/env/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py" in execute
485. return Database.Cursor.execute(self, query, params)
Exception Type: OperationalError at /admin/login/
Exception Value: unable to open database file
Need help as son as possible, thank you in advance.
Your Apache user does not have the rights needed to write to your database.
Modify your settings.py so that it shows an absolute path for your database, for example:
DATABASE_NAME = '/var/www/dashboardapp/whatever/path/db.sqlite3'
Then type the following commands at the Linux prompt to set the correct privileges:
chown www-data /var/www/dashboardapp/whatever/path/
chown www-data /var/www/dashboardapp/whatever/path/db.sqlite3
go to your project directory, just share permission with IIS user and that should do the job - if you have deployed on IIS windows server