Running Django management command on gae - django

Good day. How do I run
py manage.py migrate
On my Google app engine instance
And how to run Django admin site after deploying. I've checked the tutorials online and most are not very clear

try:
python manage.py migrate
instead of:
py manage.py migrate

Related

Django data was not brought to heroku

I have Django apps, which include users and posts models. The apps work perfectly at local following making migrations and migrating. I tried two different ways to deploy the apps to Heroku. First, using Heroku Git, the apps works on Heroku the same as at local.
When using GitHub, however, all data were not brought to Heroku. I tried to run "python manage.py makemigrations" and "python manage.py migrate" on Heroku, but the data from local was not brought still.
I would really appreciate it if you could please explain and help with the issue using GitHub.
I think you have to migrate on Heroku as well, try:
heroku run python manage.py migrate
See the heroku docs
check your .gitignore file maybe db.sqlite in gitignore file and you can remove it
another option is dumpdata and load in production
you can run
python3 manage.py dumpdata > data.json
and load data in production
python3 manage.py loaddata data.json

What is the easiest way to reset migrations in Heroku CLI?

I recently deployed Django REST API project on Heroku and I wanted to remove migrations and migrate again.
I have tried:
heroku run python manage.py migrate --app cyberminds-backend zero
but it returns:
CommandError: No installed app with label 'zero'
What are the easiest steps or commands to achieve this?

Deploying Django app to Heroku via CircleCI: How to migrate database?

How can I run python manage.py makemigrations and python manage.py migrate automatically when deploying a Django app to Heroku via CircleCI. It seems all commands run local to CircleCI, but not on the deployed application in production.
Is there a way?
python manage.py makemigrations should be running locally, and you may commit the migration files along with the code.
Regaridng the migrations, open your Procfile and add this line: release: python manage.py migrate.
This will tell Heroku to migrate before deploying a new version of your code.

Heroku Django Postgresql database admin, where is the super user?

I know it's quite newbie, but I just started using heroku. Please bear with me.
If you develop on heroku, it provides you postgresql with username and password.
However when you access it from your django admin page using that, it returns:
relation "auth_user" does not exist
LINE 1: ...user"."is_active", "auth_user"."date_joined" FROM "auth_user..
My question is what do you have to do to create the super user for the admin page?
Thanks in advance.
You can do this
heroku run python manage.py migrate
instead of
heroku run python manage.py syncdb
You can do this from a one off dyno
heroku run python manage.py syncdb
See https://devcenter.heroku.com/articles/getting-started-with-django#syncing-the-database before you do it though.
you have to make makemigrations first and migrate
heroku run python manage.py makemigrations
heroku run python manage.py migrate
and you have to createsuperuser begining
heroku run python manage.py createsuperuser u
username :*florbert
password:######

Adding South to Django project, development & production

Adding South to an existing Django project. I have it installed on both the development machine and the "production" server.
I've done the following on the development machine, then: added South app to settings.py,
python manage.py syncdb
python manage.py convert_to_south myproject.myapp
then changed some models, then
python manage.py schemamigration myproject.myapp --auto
python manage.py migrate myproject.myapp
Seems to work so far. What I am now not so sure about is what to do on the production server. Just repeat all these steps manually? Upload modified settings.py, do syncdb, convert_to_south, upload modified models.py, do schemamigration, migrate? Something different? The tutorial here says something about adding migrations to the version control, so, presumably, they should be uploaded and somehow applied on the production server?
Furthermore, right now I am using sqlite3 on the development machine and mysql on the server - does it make things any different south-wise?
My guide says:
Install South on server. import south from shell just to make sure you are using the same python env.
Add 'south' to INSTALLED_APPS in settings.py.
Upload settings.py.
Restart server
python manage.py syncdb.
Upload new app/models.py and app/migrations/ dir.
Restart server.
python manage.py migrate app --fake 0001
python manage.py migrate app
To make sure the south migration table exists,
python manage.py syncdb
and then
python manage.py migrate myproject.myapp --fake 0001
python manage.py migrate myproject.myapp
That's what's worked for me. :)
No need to do this in Django >= 1.7
i am stuck on this more then 1 hour :)
and at last find 1.7 and more have in build upgrading-from-south
for more info https://docs.djangoproject.com/en/1.7/topics/migrations/#upgrading-from-south
may be this one help you