0

I am having trouble running my django app on Heroku. Following is my file structures:

---django_blog
   ---media_cdn
   ---static_cdn
   ---Procfile
   ---requirements.txt
   ---runtime.txt
   ---src
      ---blog
         ---...
         ---settings.py
      ---manage.py
      ---...

So 'src' is actually is my project root, and 'blog' is my app. I tried made the procfile to be

web: blog.wsgi --log-file -

and

web: src.blog.wsgi --log-file -

But none of them works. When I checked the heroku logs file, I found this error:

ImportError: No module named 'blog'
DQI
  • 725
  • 1
  • 5
  • 7
  • Read the https://devcenter.heroku.com/articles/deploying-python#the-procfile, it will clear things out – copser Jul 09 '16 at 03:32

1 Answers1

2

From Heroku documentation:

First, and most importantly, Heroku web applications require a Procfile.

This file (named Procfile) is used to explicitly declare your application’s process types and entry points. It is located in the root of your repository.

You need to be more specific about how you declare your process types, if you are using gunicorn for this you will declare --chdir because you want to run it from different folder:

web: gunicorn --chdir src myproject.wsgi --log-file -

On the other hand I'm not using gunicorn rather I declare it like this:

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

FYI - Switch to gunicorn in production!

copser
  • 2,523
  • 5
  • 38
  • 73