From 8dd0f9e8815d88f338923eb70373dc944d449255 Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Sun, 31 Jan 2010 03:51:06 +0100 Subject: [PATCH] fix relatives import in gunicorn_django command --- bin/gunicorn_django | 10 +++++----- examples/djangotest/testing/urls.py | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 examples/djangotest/testing/urls.py diff --git a/bin/gunicorn_django b/bin/gunicorn_django index 3c263f4c..382f221f 100755 --- a/bin/gunicorn_django +++ b/bin/gunicorn_django @@ -28,23 +28,23 @@ import os import sys -from django.core.handlers.wsgi import WSGIHandler() +from django.core.handlers.wsgi import WSGIHandler from gunicorn.main import main - __usage__ = "%prog [OPTIONS]" PROJECT_PATH = os.getcwd() PROJECT_NAME = os.path.split(PROJECT_PATH)[-1] -# set environ -sys.path.insert(0, os.path.join(PROJECT_PATH, os.pardir)) +sys.path.insert(0, PROJECT_PATH) +sys.path.append(os.path.join(PROJECT_PATH, os.pardir)) +# set environ os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % PROJECT_NAME def get_app(parser, opts, args): # django wsgi app - return django.core.handlers.wsgi.WSGIHandler() + return WSGIHandler() main(__usage__, get_app) diff --git a/examples/djangotest/testing/urls.py b/examples/djangotest/testing/urls.py new file mode 100644 index 00000000..80c491fd --- /dev/null +++ b/examples/djangotest/testing/urls.py @@ -0,0 +1,5 @@ +from django.conf.urls.defaults import patterns, url + +urlpatterns = patterns('', + url(r'^$', 'testing.views.home'), +) \ No newline at end of file