Trying to run heroku run python manage.py migrate --remote [my app] and it is outputting a list of subcommands. Tried various other django commands with the same result, everything from 'shell' to some custom commands I invented.
heroku run python is working fine as well has other heroku commands (run ls). is there a problem with django apps at the moment? i haven't edited my heroku settings or done anything related to heroku (rolled back to much farther-back deploys and still broken, so isn't any recent code changes)
Running python manage.py help migrate on tempotrader-staging... up, run.7740
/app/.heroku/python/lib/python2.7/site-packages/stream_django/enrich.py:3: RemovedInDjango19Warning: The utilities in django.db.models.loading are deprecated in favor of the new application loading system.
from django.db.models.loading import get_model
Type 'manage.py help <subcommand>' for help on a specific subcommand.
Available subcommands:
[account]
account_emailconfirmationmigration
account_unsetmultipleprimaryemails
[auth]
changepassword
createsuperuser
[avatar]
rebuild_avatars
[charting]
update_portfolios
[django]
check
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
makemigrations
migrate
runfcgi
shell
showmigrations
sql
sqlall
sqlclear
sqlcustom
sqldropindexes
sqlflush
sqlindexes
sqlmigrate
sqlsequencereset
..... etc
Heroku fixed it!
Image of Fix
Full link here of status/incident report
Related
I am having DJango migrations problem while making migration following error is coming.
When I run my applications using python manage.py runserver it shows this :-
However, running python manage.py makemigrations shows no changes detected
And Above three images are result after running python manage.py migrate.
What is the problem with this?
When the *table> already exists Error happens, it is usually due to deleting and rerunning the initial migration or models.py file. For these scenarios,
python manage.py makemigrations <app_name>
python manage.py migrate --fake-initial <app_name>
Or if you want to fake only one migration file
python manage.py migrate <migration_file_number> --fake <app_name>
--fake-initial tells Django to mark initial migration as migrated without actually running its corresponding SQL.
Django's migration document may be helpful
looks like you changed the database or migration files manually.
try to re-create the database.
delete the DB file
delete all migrations files (keep the init file)
run create migrations command
run migrate command
I have the command heroku run -a ${{ secrets.HEROKU_APP_NAME }} python manage.py migrate set to run after pushing master to Heroku. It runs without errors (below is it's the output):
Running python manage.py migrate on ***... ?
Running python manage.py migrate on ***... done
But the migrations don't actually run. What could be the problem?
Found the answer in the Heroku docs. Essentially, add release: python manage.py migrate as the first line in the Procfile. It doesn't tell me why it's not working from the GH action, but it gets the job done.
I uploaded my modified code with some changes in models. When I run heroku run python manage.py migrate app to apply the database migrations it gave me an error
CommandError: Conflicting migrations detected (0004_auto_20150819_0827, 0008_auto_20150813_1444 in app).
To fix them run 'python manage.py makemigrations --merge'
So when I run heroku run python manage.py makemigrations --merge it gave me output:
Created new merge migration /app/app/migrations/0009_merge.py
Now how can apply this migration to my database ?
Maybe
heroku run python manage.py migrate
or to see what it's going to apply:
heroku run python manage.py showmigrations
Going through Django tutorial 1 using Python 2.7 and can't seem to resolve this error:
OperationalError: no such table: polls_poll
This happens the moment I enter Poll.objects.all() into the shell.
Things I've already tried based on research through the net:
1) Ensured that 'polls' is listed under INSTALLED_APPS in settings.py
Note: I've seen lots of suggestions inserting 'mysite.polls' instead of 'polls' into INSTALLED_APPS but this gives the following error: ImportError: cannot import name 'polls' from 'mysite'
2) Run python manage.py syncdb . This creates my db.sqlite3 file successfully and seemingly without issue in my mysite folder.
3) Finally, when I run python manage.py shell, the shell runs smoothly, however I do get some weird Runtime Warning when it starts and wonder if the polls_poll error is connected:
\django\db\backends\sqlite3\base.py:63: RuntimeWarning: SQLite received a naive datetime (2014-02-03 17:32:24.392000) while time zone support is active.
Any help would be appreciated.
I meet the same problem today and fix it I think you miss some command in tutorial 1 just do follow:
./python manage.py makemigrations polls
python manage.py sql polls
./python manage.py syncdb
then fix it and gain the table polls and you can see the table created you should read the "manage.py makemigrations" command
i figured out the mistake you did, after making changes to your models.py you should run migrate ..i.e
python manage.py migrate
then only your changes(polls_question) will be visible
For those encountering this error in the current django 3.0 release (https://docs.djangoproject.com/en/3.0/intro/tutorial02/), you can rectify it by making sure you've run the following commands in order.
python manage.py makemigrations polls
python manage.py sqlmigrate polls 0001
python manage.py migrate
I've just solved this problem in a very easy and effective way.
This error is coming because of wrong pycache and db.sqlite3 in django
To solve this error we can delete those files and re-make it.
Delete pycache and db.sqlite3 manually.
then run this in terminal:
python manage.py makemigrations polls
After this your database and __pycache will be created again. And just make migrations, it will work fine.
Of course you might want to store your data before deleting database.
I am trying to learn Django by setting up one of the projects I found on github. Afetr I ran the syncdb command it showed
Not synced (use migrations):
- django_extensions
- djangoratings
- profiles
- guardian
(use ./manage.py migrate to migrate these).
When I am running "python manage.py migrate app" , it gives
AttributeError: 'module' object has no attribute 'Migration'.
I also ran schemamigration app --auto and --initial as well. But nothing seems to be working. Can somebody point out where I am going wrong.
Are you actually running python manage.py migrate app exactly? If you want to migrate all apps, just run python manage.py migrate. (without app) If there is an app actually named app that you want to run migrations for, then you would do what you did.
If you still get the error after running python manage.py migrate, then there must be an invalid migration file somewhere. I would migrate each app individually like this:
python manage.py migrate django_extensions
python manage.py migrate djangoratings
... etc.
to find the app with bad a migration file. Once you find the app, look in the migrations folder of the app to find any empty migration files.
First thing you must run initial migration.
python manage.py schemamigration --initial
You are getting this error because of your project structure or there is some issue with your south package .try to remove and reinstalling south.
You need to see that there should not be any extra .py file in your migration folder.