leurysworld
leurysworld

Reputation: 23

Django Heroku collect static configuration error

When running git heroku push master, I'm getting two errors/messages:

Collectstatic configuration error. To debug, run: 
remote: $ heroku run python manage.py collectstatic --noinput

My app deploys successfully in spite of this. Then, I'm getting a message to upgrade pip to the latest version (7.1.2) even though it's already upgraded:

You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

I have two settings files - one for local and one for production

settings.py

BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'                       
STATICFILES_DIRS = (
   os.path.join(BASE_DIR, 'static/'),
)

settings_production.py

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

wsygi.py

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"viewelsewhere.settings_production")

from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise

application = get_wsgi_application()
application = DjangoWhiteNoise(application)

Seems to be in working order according to heroku docs here: https://devcenter.heroku.com/articles/django-assets

If I try to debug and run:

heroku run python manage.py collectstatic --noinput

I'm getting the following error:

django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No
module named psycopg2

From what I understand, this is tied to Postgresql but I'm using sqlite3 on my local and want to use Postgresql on production.

I'm so close to pushing my app live and would love help with this issue. Thanks!

Upvotes: 1

Views: 552

Answers (1)

romainm
romainm

Reputation: 281

well psycopg2 must be needed to use whitenoise :

run pip install psycopg2 in your console, then make sure you have psycopg2==2.5.3 (or whatever is the version you downloaded)in your requirements.txt file,

then try to push again and see what it says.

Upvotes: 1

Related Questions