DQI
DQI

Reputation: 785

Django Heroku Profile

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'

Upvotes: 0

Views: 898

Answers (1)

copser
copser

Reputation: 2641

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!

Upvotes: 2

Related Questions