0

I've been struggling to deploy a small Django web app following the instructions given here. I've only been using sqlite3 to build my app in my development and everything works fine on the Django development server. When I try to deploy to Heroku, I get the error "Push rejected, no Cedar-supported app detected", but I think I have all the files required to get my app up and running. Been at it for days now with no success so I'll take any suggestions and help. Below is a sketch of my app, but feel free to sift the whole thing at my github repo.

landcrab/
    landcrab/ <----- main project
        settings/
            __init__.py
            base.py
            local.py
            production.py
        __init__.py
        urls.py
        db.sqlite3
        wsgi.py
    vcrental/ <----- my app
        admin.py
        ....
    static/
        ....
    .gitignore
    db.sqlite3
    manage.py
    Procfile
    requirements.txt
    runtime.txt

In manage.py and wsgi.py I've set os.environ.setdefault("DJANGO_SETTINGS_MODULE", "landcrab.settings.production")

Procfile

web: gunicorn landcrab.wsgi --log-file -

requirements.txt (used pip freeze)

Django==1.7.1
dj-database-url==0.3.0
dj-static==0.0.6
django-toolbelt==0.0.1
gunicorn==19.1.1
jsmin==2.0.11
nose==1.3.4
psycopg2==2.5.4
pyparsing==2.0.3
python-dateutil==2.2
pytz==2014.9
six==1.8.0
static3==0.5.1

runtime.txt

python-3.4.2

For my settings file, I attempted to follow this structure

Production.py

from landcrab.settings.base import *
import dj_database_url

DEBUG = False
TEMPLATE_DEBUG = False

# Parse database configuration from $DATABASE_URL
DATABASES['default'] = dj_database_url.config()
# DATABASES['default'] =  dj_database_url.config(default='postgres://user:pass@localhost/dbname')
# DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
# DATABASES = {'default': dj_database_url.config(default=os.environ.get('DATABASE_URL'))}
# DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}

# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

# Allow all host headers
ALLOWED_HOSTS = ['*']

and finally wsgi.py

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "landcrab.settings.production") #Edited by me

from django.core.wsgi import get_wsgi_application

#Added by me for Heroku
try:
    from dj_static import Cling
    application = Cling(get_wsgi_application())
except:
    application = get_wsgi_application()
Community
  • 1
  • 1
Ben
  • 20,038
  • 30
  • 112
  • 189
  • heroku stack:set cedar-14 – Raja Simon Dec 12 '14 at 05:07
  • Does the Python runtime work on heroku? [Found that heroku supports runtime up to Python 3.4.1 at this moment](https://devcenter.heroku.com/articles/python-runtimes#supported-python-runtimes) – dazedconfused Dec 12 '14 at 05:19
  • @dazedconfused see https://devcenter.heroku.com/articles/python-support but also see my (idiotic) solution below. – Ben Dec 12 '14 at 05:29

1 Answers1

2

Well this is embarrassing. I hadn't committed my changes before attempting to deploy to Heroku. After committing, I was able to deploy without error.

Ben
  • 20,038
  • 30
  • 112
  • 189