Heroku syncdb yields 'manage.py: command not found'

I'm struggling with creating the DB on Heroku through syncdb, as I get "bash: manage.py: command not found".

From the below log, you can see that manage.py is actually in git (like it should).

(blog-venv)vagrant@precise64:/vagrant/projects/microblog$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   microblog/settings/base.py
#
no changes added to commit (use "git add" and/or "git commit -a")
(blog-venv)vagrant@precise64:/vagrant/projects/microblog$ git ls-tree -r master --name-only
.gitignore
Procfile
manage.py
microblog/__init__.py
microblog/settings/__init__.py
microblog/settings/base.py
microblog/urls.py
microblog/wsgi.py
requirements.txt
(blog-venv)vagrant@precise64:/vagrant/projects/microblog$ git commit -am "database config change"
[master a5dca31] database config change
 1 file changed, 3 insertions(+), 1 deletion(-)
(blog-venv)vagrant@precise64:/vagrant/projects/microblog$ git push heroku master
Counting objects: 9, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 441 bytes, done.
Total 5 (delta 3), reused 0 (delta 0)
-----> Python app detected
-----> No runtime.txt provided; assuming python-2.7.4.
-----> Using Python runtime (python-2.7.4)
-----> Installing dependencies using Pip (1.3.1)
       Cleaning up...
-----> Discovering process types
       Procfile declares types -> python
-----> Compiled slug size: 34.2MB
-----> Launching... done, v10
       http://fathomless-plains-7899.herokuapp.com deployed to Heroku
To [email protected]:fathomless-plains-7899.git
   6bb54f1..a5dca31  master -> master
(blog-venv)vagrant@precise64:/vagrant/projects/microblog$ heroku run python manage.py syncdb
Running `python manage.py syncdb` attached to terminal... up, run.8906
bash: manage.py: command not found
(blog-venv)vagrant@precise64:/vagrant/projects/microblog$ ls
manage.py  microblog  Procfile  requirements.txt
(blog-venv)vagrant@precise64:/vagrant/projects/microblog$

I looked through the previous questions and found nothing that could help me. As you can see, I do not have local.py in git.

Any idea?

Sorry You must be a logged in, registered user to answer a question.

Answers

What's worse is that I cannot even run the server on Heroku:

2013-08-21T13:58:47.799062+00:00 heroku[python.1]: State changed from crashed to starting 2013-08-21T13:58:48+00:00 heroku[slug-compiler]: Slug compilation finished 2013-08-21T13:58:53.372581+00:00 heroku[python.1]: Starting process with command manage.py runserver 0.0.0.0:33374 --noreload 2013-08-21T13:58:53.922027+00:00 app[python.1]: bash: manage.py: command not found 2013-08-21T13:58:55.369423+00:00 heroku[python.1]: Process exited with status 127 2013-08-21T13:58:55.385743+00:00 heroku[python.1]: State changed from starting to crashed

Any idea? I already tried restarting from scratch (new VM) and still have the same issue.

Now I'm even more confused. It seems manage.py is not the (only) issue, but even python cannot be found. But why do I get "bash: manage.py: command not found" when I'm not trying to invoke manage.py??

(blog-venv)vagrant@precise64:/vagrant/projects/microblog$ heroku run python
Running `python` attached to terminal... up, run.6657
bash: manage.py: command not found

Very confusing.

By looking for python on heroku, it can be found in /usr/bin. Calling /usr/bin/python explicitly works, but I cannot do basic stuff like 'import os'. `` (blog-venv)vagrant@precise64:/vagrant/projects/microblog$ heroku run whereis python Runningwhereis pythonattached to terminal... up, run.6370 python: /usr/bin/python /usr/bin/python2.6 /etc/python /etc/python2.6 /usr/lib/python2.6 /usr/lib/python3.1 /usr/lib64/python2.6 /usr/lib64/python3.1 /usr/local/bin/python /usr/local/bin/python2.7 /usr/local/bin/python2.7-config /usr/local/lib/python2.7 /usr/local/lib/python2.6 /usr/include/python2.6 /usr/share/python /usr/share/man/man1/python.1.gz (blog-venv)vagrant@precise64:/vagrant/projects/microblog$ heroku run /usr/bin/python Running/usr/bin/python` attached to terminal... up, run.4225 'import site' failed; use -v for traceback Python 2.6.5 (r265:79063, Oct 1 2012, 22:04:36) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import os Traceback (most recent call last): File "", line 1, in ImportError: No module named os

If you run heroku run /bin/bash and then ls once you're connected, does your manage.py show up?

I've had this problem before on Heroku, also. Manage.py isn't in the path. Try "heroku run python ./bin/django-admin.py syncdb" and see if that works?
Brandon Konkle (Staff) on
One workaround (but not a solution) to this issue is executing the python command when bash is running, see http://pastebin.com/jMUie52W. Any idea though why 'heroku run' isn't working as intended?
SaeX on
Apparently I cannot provide a full log here - please see pastebin: http://pastebin.com/zQQeB5qc . It even fails when I enter the full path. Any idea?
SaeX on