When I try to log in to admin section I get the error page:
http://localhost:8000/admin/
ProgrammingError at /admin/ ERROR: relation "django_admin_log" does
not exist
Then I noticed that 'django_admin_log' table does not exist.
captured from psql
I can not remember whether I accidentally removed it or not.
In order to recover it I checked "django.contrib.admin" is in INSTALLED_APPS in settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'db.apps.DbConfig',
'django.contrib.postgres',
'accounts.apps.AccountsConfig',
'django.contrib.sites',
'allauth',
'allauth.account',
]
and execute "python manage.py migrate admin"
But still, I can not create django_admin_log table.
PostgreSQL version is 12.6
I just mentioned the above settings in this question but still if more code is required then tell me I'll update my question with that information. Thank you
Related
I encountered an error while trying to make migration. I reinstalled the app yet i still saw the same error.
Here is my setting file:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# 3rd Party
'rest_framework',
'rest_framework.authtoken',
'allauth',
'allauth.account',
'alluth.socialaccount',
'rest_auth',
'rest_auth.registration',
# Local
'posts.apps.PostsConfig',
]
# Peculiar to django-allauth app
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
SITE_ID = 1
This is the error am getting when i run python manage.py migrate:
ModuleNotFoundError: No module named 'alluth'
The problem lies in 3rd party section of INSTALLED APPS.
'alluth.socialaccount'
it is a typo, it should be
'allauth.socialaccount',, pay attention to alluth -> allauth
I'm following the docs of django-allauth for installation, but I'm unable to manage.py migrate. I've included 'django.contrib.sites' in my INSTALLED_APPS, and SITE_ID = 1, but I get the error
django.db.utils.ProgrammingError: relation "django_site" already exists
I'm running Django 2.1.5.
I can't find anything about "django_site" already exists, only "django_site" does not exist.
What I have in installed apps, excluding internal apps:
INSTALLED_APPS = (
'authtools',
'lot',
'bootstrap4',
'storages',
'oauth2_provider',
'bootstrap_pagination',
'dal',
'cloudinary',
'django_extensions',
'django_filters',
'reversion',
'constance',
'constance.backends.database',
'rest_framework',
'django_gravatar',
'messages_extends',
'cq',
'futon',
'memoize',
'jam',
'drf_aggregates',
'batch_requests',
'webpack_loader',
'django_prometheus',
# Core
'django.contrib.sites',
'django.contrib.postgres',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
# Channels
'channels',
'channels_redis',
# allauth
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.google',
)
So it turns out I had previously had django.contrib.sites as an INSTALLED_APP before, so the migration failed. Fix was just to run ./manage.py migrate --fake-initial
Try this
python manage.py migrate sites
python manage.py migrate
In INSTALLED_APPS keep 'django.contrib.sites' at top.
I am trying to build my app in Travis but I keep getting the following error which I am unable to debug. Can anybody see anything obvious that I may be doing wrong?
RuntimeError:
Model class
Code-Institute-Milestone-Project-05.babysitters.models.Babysitter
doesn't declare an explicit app_label and isn't in an application in
INSTALLED_APPS.
INSTALLED_APPS = [
'about',
'accounts',
'blog',
'bookings',
'babysitters',
'contact',
'checkout',
'storages',
'django.contrib.admin',
'django.contrib.humanize',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_forms_bootstrap',
'django_gravatar',
'home',
I was able to resolve this. It turns out that my tests.py file was not correctly formatted and was producing this error. Once I rectified this the build passed. Thank you.
So following the current Django-allauth documentation, I keep getting this minor syntax error when I thought I followed the documentation to every last detail.
Terminal error after running: ./manage.py migrate
/settings.py", line 43
'django.contrib.auth',
^
SyntaxError: invalid syntax
My settings.py file: Was I not supposed to keep the default apps above the allauth section?
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
...
# The following apps are required:
'django.contrib.auth',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
# ... include the providers you want to enable:
'allauth.socialaccount.providers.amazon',
'allauth.socialaccount.providers.angellist',
'allauth.socialaccount.providers.asana',
The error is coming because 'django.contrib.auth' is repeating
'django.contrib.admin',
'django.contrib.auth',
and again
# The following apps are required:
'django.contrib.auth',
I am getting a traceback identical to the one at this link, http://pastebin.com/Bq1Q0ert, whenever I run my project and visit it at any url.
I had resolved this issue previously by having the project serve at 0.0.0.0:8000, but now this seems to not be working either.
I am running django 1.4 and have under INSTALLED_APPS:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admindocs',
'django.contrib.humanize',
'django.contrib.webdesign',
'admin_tools',
'admin_tools.theming',
'admin_tools.menu',
'admin_tools.dashboard',
'apps.pages',
'apps.news',
'south',
'translatable',
'easy_thumbnails',
'debug_toolbar',
'tinymce',
'rosetta',
'django_extensions',
'sorl.thumbnail',
'vendor.filebrowser',
'vendor.countries')..
UPDATE:
I have found that django.conf.settings.INSTALLED_APPS does not contain what is in settings.INSTALLED_APPS.
I have resolved this issue by adding this code to settings_local;
from settings import *
This does not cause any cyclic imports.