Error in Heroku run python manage.py syncdb - django

I'm using django==1.5.1 and I got this error below. Earlier I was using django==1.4.2 and didn't got such error following the same tut in GSWD (I did not update the django version in the middle of the project).
(edu-venv)vagrant#precise32:/vagrant/projects/kodeworms$ heroku run python manage.py syncdb
Running `python manage.py syncdb` attached to terminal... up, run.9132
ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check setti
ngs documentation for more details.
This looks like I missed something which is related more specifically to django==1.5.1 version. Can someone help ?

Someone gave this solution and it worked for me
Original Link: http://gettingstartedwithdjango.com/questions/1/error-in-heroku-run-python-managepy-syncdb/
If you type heroku config you'll get the heroku environment values.
Mine only showed:
HEROKU_POSTGRESQL_BRONZE_URL: postgres://tcmgahtgsrmufa:iyA2dKD5bnO4f7jyv6MSu4453g#ec2-54-225-68-241.compute-1.amazonaws.com:5432/d6oj663f28smnh - there was no DATABASE_URL which dj_database_url.config needs. So then I found our from https://devcenter.heroku.com/articles/heroku-postgresql that you need to promote this to DATABASE_URL. The commands is : heroku pg:promote HEROKU_POSTGRESQL_RED_URL (replace with whatever environment variable your set-up is using). So far so good. I came here to post as soon as I tried this out. I haven't rerun yet but it should work.

Related

Unable to push migrations to Heroku from Django

I am a student, going through a tutorial to build a website with Next.js and Django/Python. I have zero experience with this stuff and it's been a painful process so far.
At this point in the tutorial, I have created a Heroku account and have deployed my Django project to Heroku through git and have also created the postgreSQL database.
The next step, as the dude in the video says, is to migrate the data from django into the database. I've done the whole "py manage.py makemigrations" locally and then tried to push those files to Heroku as I've read in other threads, but that doesn't work. In the tutorial, the guy just runs: heroku run python manage.py makemigrations, and it works fine. This is what happens when I try it:
I don't understand what to do...I've been Googling for the last hour or so and cannot find a solution...I appreciate anyone who can help me, I'm sure it's something stupid/simple, but I am not a programmer or developer, so I have no clue at this point...
Seems like manage.py is not commit to your git repo, try to add it:
git add manage.py
git commit
git push heroku master
Figured it out, just needed to add the path to manage.py and it worked :)

How to start a django project on one that is already created?

I already have a django project and all files created, but I am trying to deploy to a server. I moved files over to server using FileZilla and I am in putty now trying to django-admin startproject practice ~/practice but I get a command error stating that this already exists which obviously it does but then if I want to manage.py makemigrations I get a -bash: Permission denied and I am guessing that is because I have not started django project here on putty??? I hope there is enough info here to explain my issue. Any help is appreciated
You need run python manage.py runserver in the correct folder with admin permisions.

Getting error while running django_cron

When am trying to run the chron job in django using below command
python manage.py runcrons
its showing one error like below
$ python manage.py runcrons
No handlers could be found for logger "django_cron"
Does any one have any idea about this error? Any help is appreciated.
It is kind of given in the error you get. You are missing a handler for the "django_cron" logger. See for example https://stackoverflow.com/a/7048543/1197616. Also have a look at the docs for Django, https://docs.djangoproject.com/en/dev/topics/logging/.
Actually the django-cron library does not require a 'django_cron' logger. I resolved the same problem by running the migrations of django_cron:
python manage.py migrate #migrate database

heroku - DatabaseError: relation "south_migrationhistory" does not exist

i purchased an outsource service to develop a web site in django to be deployed in heroku and AWS S3 (boto package).
Unfortunately the developer did not comment the code, despite it was asked, and left the project uncompleted for following up with a bigger client.
I've hired another django 'expert' to fix a part which was not developed, and he want to (over)charge for deployment testing, which i think should be a normal matter for good practices! i am working on my own budject, and need to work it out myself.
I was able to make the project run locally and make myself the frontend templates which were not fully developed, but I am having issues in deploying the code on my own staging environment.
I set up a staging environment under my credential to check if everything is ok, before pushing to production.
I think I almost get there, though:
heroku run python manage.py migrate --all --noinput --app my-app-staging
generate in the console:
Running `python manage.py migrate --all --noinput` attached to terminal... up, run.4833
DatabaseError: relation "south_migrationhistory" does not exist
LINE 1: ...gration", "south_migrationhistory"."applied" FROM "south_mig...
In the browser:
DatabaseError at /
relation "django_site" does not exist
LINE 1: ..."django_site"."domain", "django_site"."name" FROM "django_si...
^
Request Method: GET
Request URL: http://my-app-staging.herokuapp.com/
Django Version: 1.5.6
Exception Type: DatabaseError
Exception Value:
relation "django_site" does not exist
LINE 1: ..."django_site"."domain", "django_site"."name" FROM "django_si...
^
Exception Location: /app/.heroku/python/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py in execute, line 5
I checked my settings and they look ok:
i check AWS S3 bucket and it is able to write there;
settings in heroku console display that the db has been created.
I followed:
Heroku created table but when I'll migrate, he says that doesn't created
but it looks my locals.py are ok too, and in my local git branch .gitignore will exclude db.sqlite
My git and heroku ssh keys have been generated and added, so i dont' think it is an issue of authentification.
How could i check that the db is properly connected to django project and I am not invalidated?
Could you please help in debriefing to understand what this error means and how to solve it?
So much thank you.
It sounds like you might not have created the initial South migration tables on your staging server. This is actually done using syncdb:
Once South is added in, you’ll need to run ./manage.py syncdb to make the South migration-tracking tables (South doesn’t use migrations for its own models, for various reasons).
To run this on Heroku, you'll probably want to use something like
heroku run python manage.py syncdb
Once this is done, you should be able to move forward with the South commands.

Django: Heroku migrations resulting in an error

I've been finishing up my first Django app and have run into a snag with migrations in Heroku. I migrated with South locally and then attempted to move those migrations to the database on Heroku.
When I ran:
heroku run stentorian/manage.py syncdb migrate report
I received the following error:
['/app/stentorian', '/app/.heroku/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg', '/app', '/app/.heroku/venv/lib/python27.zip', '/app/.heroku/venv/lib/python2.7', '/app/.heroku/venv/lib/python2.7/plat-linux2', '/app/.heroku/venv/lib/python2.7/lib-tk', '/app/.heroku/venv/lib/python2.7/lib-old', '/app/.heroku/venv/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/app/.heroku/venv/lib/python2.7/site-packages', '/app/.heroku/venv/lib/python2.7/site-packages/PIL']
Error: Command doesn't accept any arguments
I've researched this and can't seem to find how to resolve this. Prior to this, I installed the django-flaggit app to my application, which doesn't use migrations, and had to use a traditional syncdb to get the tables set up in Heroku. I'm wondering if this had an affect.
If anyone has any insight into this issue, it would be much appreciated.
What you are doing here is actully calling two different commands in a row: syncdb and migrate.
The usual workflow with south is to run syncdb to sync all your non-south-supported apps, and then migrate, to work on south-supported apps. Actually, if you just run syncdb with south installed, it will tell you which apps are unsynced and must be migrated.
So, to summarize:
heroku run stentorian/manage.py syncdb
heroku run stentorian/manage.py migrate report