Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django Deploy using Heroku - [Errno 2] No such file or directory

I get this error ([Errno 2] No such file or directory) after I push the repo to heroku master. Here are my logs.

2012-04-17T18:24:53+00:00 app[web.1]: python: can't open file '/test/project/manage.py': [Errno 2]     No such file or directory

2012-04-17T18:24:54+00:00 heroku[web.1]: Process exited with status 2

2012-04-17T18:24:54+00:00 heroku[web.1]: State changed from starting to crashed

2012-04-17T18:24:54+00:00 heroku[web.1]: State changed from crashed to created

2012-04-17T18:24:54+00:00 heroku[web.1]: State changed from created to starting

2012-04-17T18:24:57+00:00 heroku[web.1]: Starting process with command python /test/project/manage.py runserver 0.0.0.0:4473 --noreload 2012-04-17T18:24:57+00:00 app[web.1]: python: can't open file '/test/project/manage.py': [Errno 2] No such file or directory

My Procfile looks like the following:

web: python /test/project/manage.py runserver 0.0.0.0:$PORT --noreload

I don't know why it can't open the file. It opens fine when I am using my development server. Any ideas? Thanks for reading.

like image 377
Zach Avatar asked Apr 17 '12 23:04

Zach


2 Answers

Your current setup in your Procfile references an absolute path '/test/project/manage.py' that doesn't exist on Heroku. The '/test/ is the root of the instance you're running in and is incorrect. You should first change this to be the relative path, this is likely something like:

web: python project/manage.py runserver 0.0.0.0:$PORT --noreload

If this does not work you can explore the location of the project by running:

heroku run bash

This should place you in '/app' from here you can see what the path to start your project is.

Since your initial push likely failed to start the process you'll likely need to scale a web process. You can then do this with:

heroku scale web=1
like image 78
CraigKerstiens Avatar answered Nov 01 '22 05:11

CraigKerstiens


you can attach an ls to heroku to find out the actual structure of the file system.

> heroku run ls /
Running ls / attached to terminal... up, run.1
app  dev  home  lib64       mnt   sbin  usr
bin  etc  lib   lost+found  proc  tmp   var

It might be the case that they wrap your app inside an app directory

like image 26
Doboy Avatar answered Nov 01 '22 05:11

Doboy