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

I get this error ([Errno 2] There is no such file or directory) after I push the repo to masterk. Here are my magazines.

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 is as follows:

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

I do not know why it cannot open the file. It opens perfectly when I use my development server. Any ideas? Thanks for reading.

+5
source share
4 answers

Your current setup in your Procfile refers to the absolute path '/test/project/manage.py', which does not exist on Heroku. "/ Test / is the root of the instance you are working on, and is incorrect. You must first change this as a relative path, this is probably something like:

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

, , :

heroku run bash

'/app', , .

, , , , , -.

heroku scale web=1
+11

ls , .

> 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

, app

0

os.path, . , ProcFile ? python hellodjango/manage.py

:

, :

  • pip install -r ./requirements.txt

  • foreman start

  • heroku create mempy-demo --stac=cedar

  • git

"Hello World":

$ curl mempy-demo.herokuapp.com
0

- , (, wsgi.py, ):

os.environ["DJANGO_SETTINGS_MODULE"] = "myblog.settings"                                                                
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myblog.settings")
0
source

All Articles