TastyPie Migration - django

I am getting the following error
After python manage.py syncdb
It says everything is synced, but then I see this
Not synced (use migrations):
- tastypie
How do I sync tastypie?
I also have South synced. As apparently that makes a difference.
The following SO question referred to this problem but did not solve it or at least I did not understand the solution: South manages a new app instead of syncdb
Can you please help me with this, thanks.
Keep in mind that this is my first time using Django
I saw another solution online but it required the app name and I put the app name down but it did not work (or maybe i don't know my app name). How do you find out the app name?

django-admin.py migrate tastypie

Related

Will migrate zero save my migrate --fake mishap?

I have Django webapplication running on Heroku with Heroku Postgres. A few days ago I made a few changes to an app's models, adding and then removing unique=True to some model fields (among other things, just messing around a bit) and making some migrations. This surely broke something, and unfortunately I didn't discover this until a few days later, after I had made a lot of additional migrations in my local db. The only way I was able to fix it was with a:
python manage.py migrate --fake
This worked out OK on my local/dev postgres, but in production it is still broken when I try to make migrations and migrate. When running migrate:
django.db.utils.ProgrammingError: table "publicinteraction_smoothmessage_extra_software" does not
exist
Since it has been a few days, I don't know exactly which migration I faked or not, and the section in Django docs about "risk of manually having to correct --fake" was also seen too late...
Will it help to run python manage.py migrate publicinteraction zero or will this result in my data getting lost?
This is my first project in production with real users and encountering such issues is all new to a self-taught developer in Python and Django. Poking around and messing up a production database feels a bit itchy and way too nerve-wracking for my skill level at the moment.
How should I proceed without losing all my data? Best practices to keep in mind for the future when it comes to making migrations localy vs production is also very much appreciated :)

"django.db.utils.ProgrammingError: relation "auth_user" does not exist" Django V2.0

I've recently upgraded Django to V2.0 and I'm unable to make migrations due to the following error:
django.db.utils.ProgrammingError: relation "auth_user" does not exist
I know a similar bug existed in V1.8 which I fixed by migrating the model which others depend on, i.e. auth_user and then the rest:
python manage.py migrate auth
python manage.py migrate
When I try to migrate 'auth' I encounter the same error. Has anybody encountered/found a solution to this?
I encountered the same error.
At last I found the root cause was the database.
There may be some auth info in the database already.
Editing setting.py and using another new database will solve this problem.
I have same issue even after creating new database.
What helped me, is choosing another owner, when creating new DB, not postgress owner. Also I was using
py manage.py migrate myapp
with this command, I have the same issue as well
But when I tried use
py manage.py migrate
and change owner from postgress on DB creating, it helped!
I ran into the same problem after I upgraded my DB with new/removed apps and forgot to upgrade my asgi.py and wsgi.py files to point to the upgraded settingsprod.py (for anyone who was following along with the eCommerce CodingWithStein). I then had to restart my nginx and gunicorn services.

Django: Heroku deploy not migrating properly

I'm new to Heroku and I am trying to do my first deploy with a change in my models. Now I already have some important stuff in my app's database that I don't want to lose (I'm using PostgresSQL).
Anyway, I did those few improvement to my app's model and it works alright locally, but when I try to deploy it just gives me the
Internal Server Error: /lares/
ProgrammingError at /lares/
column lares_imovel.referencia does not exist
I am used to throwing makemigrations and migrate locally and than just git push heroku master
Anyway, I also tried the heroku run python manage.py migrate afterwards, but I get the same result every time.
I deleted all my migrations files and created them again for this particular app, still it works locally and the issue remains on production.
Do you guys have any idea why this is happening?
I don't know if any of my code is necessary, I'm pretty sure the problem is not there, but if requested I can post it here.
Thanks!

How to deal with old pip requirement in Django South migrations?

I have an app which is managed with South for quite a while. At one point of the development, I added a custom field to a model that had a pip requirement (sorl-thumbnail), but I removed this requirement later. My problem is that when I try to migrate this app in a fresh new database, South shouts:
./manage.py migrate my_app
...
ValueError: Cannot import the required field 'sorl.thumbnail.fields.ImageField'
How am I suppose to deal with this old requirement?
Maybe a dirty solution but if you really want to get rid of your sorl-thumbnail dependency you don't have much choice :
Locate the migration file in which the field was added and replace sorl.thumbnail.fields.ImageField by something like django.db.models.fields.files.ImageField
It should work unless you have DataMigrations depending on special features of sorl-thumbnail.

south migration error app "is not available in this migration"

This problem is basically the same as the previous question
here.
However, the answer there does not work for me. I've installed the trunk version of south, manually entered the import line in the migration file in question, and done a full 'startmigration' in a separate directory and examined the 0001_initial.py file.
I have a Django project with several applications in it, one of them (named 'core') being referred to by the others. The south migration is trying to create a new table, with a column that has a foreign key to a model in core.
I'm currently importing core in the migration in question (0006), and I even added it to migration 0001, although it doesn't seem like that should matter.
Before I do something drastic, like removing that field, running the migration, and adding the field manually, is there a known manual workaround for fixing this south issue?
You probably did not use the --freeze option like this:
python manage.py startmigration <appname> migrate_core --freeze core
Having created a migration like so:
./manage.py startmygration appname --model NewModel
This error occurs:
"The model 'program' from the app 'core' is not available in this migration."
Recreating the migration like this fixes it:
./managepy startmigration appname --model NewModel --freeze core.Program
Just doing "--freeze core" did not do the trick for me.
You can receive this error by trying to access a class that resides in another django app. Check to make sure the class you are trying to access is in the models dictionary.