Closed kutenai closed 8 years ago
Getting the same issue as well with 1.8, although this is for a new project (no existing migrations, etc.). manage.py migrate
only succeeds when the "account"
app is removed.
EDIT:
This seems to work, run migrate auth
first, which fails, and then migrate
succeeds:
$ ./manage.py migrate auth
... # fails with
django.db.utils.ProgrammingError: relation "django_site" does not exist
LINE 1: SELECT (1) AS "a" FROM "django_site" LIMIT 1
^
$ ./manage.py migrate
... OK
Although it's just a workaround and doesn't solve the real issue.
If you create a project using django 1.8.2 django.contrib.sites
is not automatically included in your installed app and it's a needed dependencies: http://django-user-accounts.readthedocs.org/en/latest/installation.html#django-contrib-sites
the fix is quick:
add django.contrib.sites
to your INSTALLED_APPS
for reference:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites'
)
and run the migrate command
For my case, I already have django.contrib.sites
in the project.
did you run python manage.py migrate
?
The table should be created by that.
ah running python manage.py migrate
fails because of the "account"
app, so I need to do python manage.py migrate auth
first, which fails but is another issue with regards to sites
app I guess.
EDIT: err wait, let me try again later with a fresh database.
Any solution for this issue? I'm still having the same problem. Would be great to have a fix.
I will be looking at this issue today.
Hi, any body got solution? same problem for me.
$python manage.py migrate django.db.utils.ProgrammingError: relation "auth_user" does not exist $python manage.py migrate auth django.db.utils.ProgrammingError: relation "django_site" does not exist LINE 1: SELECT (1) AS "a" FROM "django_site" LIMIT 1
@ravigadila can you post your INSTALLED_APPS
?
@brosner
INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'djangocms_admin_style', 'django.contrib.admin', 'django_extensions', 'django_model_changes', 'django_messages', 'userena', 'guardian', 'easy_thumbnails', 'mathfilters', 'crispy_forms', 'accounts', 'paypal.standard.ipn', 'loans', 'messaging', 'rest_framework', 'rest_framework.authtoken', )
I am having a hard time reproducing this problem. What database are you using @ravigadila?
Same problem Postgresql database
Kind of same problem -
Applying admin.0001_initial...Traceback (most recent call last): File "/Users/amarchaudhari/Documents/gaurav_project/fit/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) psycopg2.ProgrammingError: relation "main_myuser" does not exist
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 10, in
I don't like how so many people have commented on this issue saying they have an issue, but I cannot reproduce it. I really want to find a fix for what's going on. If anyone has a project where this is easily reproducible, could you share it with me? I suspect there is something going on that is hidden in the project.
@john2x: you seem to be my only hope as you claim you can reproduce this with a fresh started project. Are you still able to reproduce this issue?
What version of DUA are people using that are experiencing this issue? I have not been able to reproduce this problem with 1.2 in both scenarios -- upgrading from 1.7 to 1.8 or starting fresh with 1.8.
I narrowed this down to switching to postgres DB, at least in my case. The project works on sqlite, but when switched to postgres, this error pops up. This breaks the whole test /infrastructure process.
@jeymichael I have tested against both SQLite and PostgreSQL. Which version of PostgreSQL are you running?
Postgres 9.4.5.0
$ cat requirements.txt Django==1.8.6 djangorestframework==3.3.1 psycopg2==2.6.1 requests==2.8.1 wheel==0.24.0
Brian, I have the archived project as well, if you need it.
@jeymichael thanks for the info. I am going to start a project using those exact requirements and versions. I'll let you know if I need it.
@jeymichael are you on our Pinax Slack instance? It'd be really helpful for me if you joined the #django-user-accounts channel and we can talk there. http://slack.pinaxproject.com to join.
I have finally figured out what is likely happening here. With the help of @jeymichael I was able to track down the exception. Jey wasn't using django-user-accounts, but his test project showed me the issue.
Our 1.0.x releases did not have Django migrations. Due to the lack of migrations (largely due to the development of DUA prior to its 1.0 release was pre-1.7) and django.contrib.auth
gaining migrations in Django 1.7 this has caused a dependency issue. I don't know exactly why it worked in 1.7 and fails on 1.8. The issue is that an app without migrations that depends on an app with migrations most likely won't be handled correctly. Apps without migrations are created in the database before apps with migrations. Meaning because django-user-accounts depends on django.contrib.auth.User
it was being sync'd to the database when auth_user
didn't exist.
1.1+ of django-user-accounts contain migrations and will solve this issue for those affected.
This error also occurred in Django 1.9
I ran the following command and it worked
$ ./manage.py migrate auth
:+1:
Getting the same error.
python manage.py makemigrations auth
No changes detected in app 'auth'
In [1]: from django.contrib.auth.models import User In [2]: user = User.objects.create_user('test', 'test@test.com', 'testpass' )
ProgrammingError: relation "auth_user" does not exist LINE 1: INSERT INTO "auth_user" ("password", "last_login", "is_super...
Django 1.9.2 DB: Postgresql INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'corsheaders',
'rest_framework',
'execute',
]
The still also persists in Django v.1.11 @brosner (been navigation through fixes and none is present for this one) With the following installed apps
INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.humanize', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles',
None of those commands resolved this issue (Django 2). I deleted my database and migrate again :/ , that's do worked haha
Just delete the existing data and create a new one, then try ./manage.py migrate
@Revel109 ive done that and still getting this error when deploying to heroku
ProgrammingError at / relation "posts_post" does not exist LINE 1: ...evious_post_id", "posts_post"."next_post_id" FROM "posts_pos... ^
I think it's been appearing in the django-2.2 version also
I see it in django-3.0 as well, with postgres.
hey, I have found the reason for this issue. It pops with relation "auth_user" does not exist
whenever we try to reference to User
from django.contrib.auth.models
before building our first auth migrations. So the solution for this that worked for me was Commenting out any reference to the User model and then running the migrations, later you can uncomment User model references and run new migrations.
@ShashankJaitly I think, it's not a good practice to do it. DUA really resolved this issue in later stage but the django updated the version recently, May be it's not depreciated yet.
@memetics19 Yes, you may right. But I recently got this issue while working on Django 3.0.6 and I managed to get through it just like I mentioned in my last comment, and it worked fine.
i got the same issu using cassandra (django version 4.1.7 )> Any suggestions ?
@rashabeka - make sure you have run all the migrations for the apps you are using
I updated my project from 1.7.x to 1.8.2, and tests failed with the above issue. I've tried a number of solutions to fix this, and I did narrow it down to django-user-accounts. When I comment that project out, things work.
I reverted back to Django 1.7.6, and the tests work fine. I was unable to find any references to that error related to django-user-accounts, but I did find references related to other projects that seem to say that a migration is required. This project currently has no migrations. That is just a wild guess on my part..
This project claims support for Django 1.8, so I'm confused about why I'm getting this error, and others are not.