Django Fix Gunicorn Error “ImportError: No module named validation”

Today I’m trying to deploy django app to my VPS. I choose Gunicorn because their simple configuration. But when I run the wsgi server on gunicorn with this command.

$ gunicorn_django --bind mydomainOrvpsIp:8001

I got this error.

[2016-02-11 04:56:38 +0000] [15787] [ERROR] Exception in worker process:
Traceback (most recent call last):
  File "/root/.virtualenvs/portofolio/lib/python2.7/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker
    worker.init_process()
  File "/root/.virtualenvs/portofolio/lib/python2.7/site-packages/gunicorn/workers/base.py", line 122, in init_process
    self.load_wsgi()
  File "/root/.virtualenvs/portofolio/lib/python2.7/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/root/.virtualenvs/portofolio/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/root/.virtualenvs/portofolio/lib/python2.7/site-packages/gunicorn/app/djangoapp.py", line 105, in load
    mod = util.import_module("gunicorn.app.django_wsgi")
  File "/root/.pyenv/versions/2.7.11/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/root/.virtualenvs/portofolio/lib/python2.7/site-packages/gunicorn/app/django_wsgi.py", line 21, in <module>
    from django.core.management.validation import get_validation_errors
ImportError: No module named validation

To fix this, we need to use latest command to run our app in gunicorn, because previous command already deprecated.

$ gunicorn --bind mydomainOrvpsIp:8001 myproject.wsgi:application

Reference: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-local-django-app-to-a-vps?comment=12057

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s