django - Gunicorn is unable to find my wsgi file, not able to load python? -


so trying run gunicorn script, following tutorial found in internet.

here folder structure:

(today_project)[littlem@server1 today_project]$ tree . -l 2 . ├── bin │   ├── activate │   ├── activate.csh │   ├── activate.fish │   ├── activate_this.py │   ├── django-admin.py │   ├── django-admin.pyc │   ├── easy_install │   ├── easy_install-2.7 │   ├── gunicorn │   ├── gunicorn_django │   ├── gunicorn_paster │   ├── gunicorn_start │   ├── pip │   ├── pip2 │   ├── pip2.7 │   ├── python -> python2.7 │   ├── python2 -> python2.7 │   └── python2.7 ├── include │   ├── python2.6 -> /usr/include/python2.6 │   └── python2.7 -> /usr/local/include/python2.7 ├── lib │   ├── python2.6 │   └── python2.7 ├── manage.py ├── run │   └── gunicorn.sock ├── today │   ├── #app files ├── today_project │   ├── __init__.py │   ├── __init__.pyc │   ├── __pycache__ │   ├── settings.py │   ├── settings.pyc │   ├── urls.py │   ├── urls.pyc │   ├── wsgi.py │   └── wsgi.pyc └── todo.md 

when run

gunicorn today_project.wsgi:application 

from virtualenv, works fine. when run script (i pretty copied somewhere):

#!/bin/bash  name="today" # name of application djangodir=~/today_project/today_project # django project directory sockfile=~/today_project/run/gunicorn.sock # communicte using unix socket user=ferski # user run group=ferski # group run num_workers=3 # how many worker processes should gunicorn spawn django_settings_module=today.settings # settings file should django use django_wsgi_module=today.wsgi # wsgi module name  echo "starting $name `whoami`"  # activate virtual environment cd $djangodir source ../bin/activate export django_settings_module=$django_settings_module export pythonpath=$djangodir:$pythonpath  # create run directory if doesn't exist rundir=$(dirname $sockfile) test -d $rundir || mkdir -p $rundir  # start django unicorn # programs meant run under supervisor should not daemonize (do not use --daemon) exec ../bin/gunicorn ${django_wsgi_module}:application \ --name $name \ --workers $num_workers \ --user=$user --group=$group \ --log-level=debug \ --bind=unix:$sockfile 

i have following error

traceback (most recent call last):   file "/home/ferski/today_project/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker     worker.init_process()   file "/home/ferski/today_project/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process     self.wsgi = self.app.wsgi()   file "/home/ferski/today_project/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi     self.callable = self.load()   file "/home/ferski/today_project/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load     return self.load_wsgiapp()   file "/home/ferski/today_project/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp     return util.import_app(self.app_uri)   file "/home/ferski/today_project/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app     __import__(module) importerror: no module named today_project.wsgi 2014-04-06 16:09:28 [19420] [info] worker exiting (pid: 19420) 2014-04-06 16:09:28 [19407] [info] shutting down: master 2014-04-06 16:09:28 [19407] [info] reason: worker failed boot. 

so guess problem python version? dont know doing honest when export pythonpath=$djangodir:$pythonpath guess problem lies

i think djangodir should ~/today_project/. it's root of tree, not inner directory.

there few other things wrong, too: in particular, since you're running in virtualenv, shouldn't need change pythonpath @ all.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -