# HG changeset patch # User ymh # Date 1296215029 -3600 # Node ID 6a2a816d4ba32edaa3618a2da9a7f745b515b453 # Parent bdf22b140727cb91697cc0cd2ba351d9cb5d2472 correct virtual env res + htaccess + mod wsgi diff -r bdf22b140727 -r 6a2a816d4ba3 src/ldt/ldt/core/handlers/modwsgi.py --- a/src/ldt/ldt/core/handlers/modwsgi.py Thu Jan 27 18:59:34 2011 +0100 +++ b/src/ldt/ldt/core/handlers/modwsgi.py Fri Jan 28 12:43:49 2011 +0100 @@ -2,23 +2,23 @@ def application(environ, start_response): os.environ['DJANGO_SETTINGS_MODULE'] = environ['DJANGO_SETTINGS_MODULE'] - os.environ['PY_USE_XMLPLUS'] = environ['PY_USE_XMLPLUS'] prev_sys_path = list(sys.path) sys.path.append(environ['PROJECT_PATH']) - site.addsitedir(environ['PYTHON_PATH']) + for path in environ.get('PYTHON_PATH',"").split(os.pathsep): + if path: + site.addsitedir(path) new_sys_path = [] for item in list(sys.path): if item not in prev_sys_path: new_sys_path.append(item) - sys.path.remove(item) + sys.path.remove(item) sys.path[:0] = new_sys_path import django.core.handlers.wsgi _application = django.core.handlers.wsgi.WSGIHandler() - return _application(environ, start_response) - + return _application(environ, start_response) \ No newline at end of file diff -r bdf22b140727 -r 6a2a816d4ba3 virtualenv/web/create_python_env.py --- a/virtualenv/web/create_python_env.py Thu Jan 27 18:59:34 2011 +0100 +++ b/virtualenv/web/create_python_env.py Fri Jan 28 12:43:49 2011 +0100 @@ -200,45 +200,11 @@ if system_str == 'Linux' and 'DISTRIBUTE' not in ignore_packages: normal_install('DISTRIBUTE', 'pip', None, None, res_source_key, home_dir, tmp_dir) - if 'PYXML' not in ignore_packages: - logger.notify("PyXML install : %s " % URLS['PYXML'][res_source_key]) - if sys.version_info >= (2,6): - logger.notify("PyXML -> python version >= 2.6 : patching") - pyxml_src = os.path.join(src_dir,"pyxml.tar.gz") - urllib.urlretrieve(URLS['PYXML'][res_source_key], pyxml_src) - logger.notify("PyXML -> python version >= 2.6 : extract archive") - tf = tarfile.open(pyxml_src,'r:gz') - pyxml_base_path = os.path.join(src_dir,"pyxml") - tf.extractall(pyxml_base_path) - tf.close() - - #patch - pyxml_version = os.listdir(pyxml_base_path)[0] - pyxml_path = os.path.join(pyxml_base_path, pyxml_version) - olddir = os.getcwd() - os.chdir(pyxml_path) - logger.notify("PyXML -> python version >= 2.6 : do patch %s : %s " % (pyxml_path, URLS['PYXML']['patch'])) - p = patch.fromfile(URLS['PYXML']['patch']) - p.apply() - os.chdir(olddir) - logger.notify("PyXML -> python version >= 2.6 : install") - call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-E', os.path.abspath(home_dir), '--build='+os.path.abspath(pyxml_base_path), '--no-download', pyxml_version], - cwd=os.path.abspath(tmp_dir), - filter_stdout=filter_python_develop, - show_stdout=True) - else: - call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-E', os.path.abspath(home_dir), URLS['PYXML'][res_source_key]], - cwd=os.path.abspath(tmp_dir), - filter_stdout=filter_python_develop, - show_stdout=True) - - NORMAL_INSTALL = [ #(key,method, option_str, extra_env) #('LXML', 'easy_install', None, {'STATIC_DEPS': 'true'}), ('PSYCOPG2', 'pip', None, None), ('MYSQL', 'pip', None, None), ('PIL', 'pip', None, None), - ('FOURSUITE_XML','easy_install', None, None), ('DJANGO','pip', None, None), ('JOGGING','pip', None, None), ('DJANGO-EXTENSIONS', 'pip', None, None), diff -r bdf22b140727 -r 6a2a816d4ba3 virtualenv/web/res/src/lxml-2.2.8.tar.gz Binary file virtualenv/web/res/src/lxml-2.2.8.tar.gz has changed diff -r bdf22b140727 -r 6a2a816d4ba3 web/.htaccess --- a/web/.htaccess Thu Jan 27 18:59:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -RedirectMatch permanent ^/~ymh/franceculture/?$ /~ymh/franceculture/franceculture diff -r bdf22b140727 -r 6a2a816d4ba3 web/.htaccess.tmpl --- a/web/.htaccess.tmpl Thu Jan 27 18:59:34 2011 +0100 +++ b/web/.htaccess.tmpl Fri Jan 28 12:43:49 2011 +0100 @@ -1,1 +1,1 @@ -RedirectMatch permanent /~ymh/franceculture/?$ /~ymh/franceculture/franceculture +RedirectMatch permanent /~ymh/platform/?$ /~ymh/platform/platform diff -r bdf22b140727 -r 6a2a816d4ba3 web/platform/.htaccess --- a/web/platform/.htaccess Thu Jan 27 18:59:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -SetHandler python-program -PythonHandler ldt.core.handlers.modpython -SetEnv DJANGO_SETTINGS_MODULE franceculture.settings -SetEnv PY_USE_XMLPLUS true -PythonInterpreter franceculture -PythonOption django.root /~ymh/franceculture/franceculture -PythonOption virtualenv.activate_path /Users/ymh/dev/workspace/franceculture/sbin/virtualenv/env/venv/bin/activate_this.py -PythonDebug on -PythonPath "['/Users/ymh/Sites/franceculture'] + sys.path" -Header set Pragma "no-cache" -Header set Cache-Control "no-cache" -Header set Expires "-1" diff -r bdf22b140727 -r 6a2a816d4ba3 web/platform/.htaccess.mod_python.tmpl --- a/web/platform/.htaccess.mod_python.tmpl Thu Jan 27 18:59:34 2011 +0100 +++ b/web/platform/.htaccess.mod_python.tmpl Fri Jan 28 12:43:49 2011 +0100 @@ -1,9 +1,9 @@ SetHandler python-program PythonHandler ldt.core.handlers.modpython -SetEnv DJANGO_SETTINGS_MODULE franceculture.settings +SetEnv DJANGO_SETTINGS_MODULE platform.settings SetEnv PY_USE_XMLPLUS true -PythonInterpreter franceculture -PythonOption django.root /~wakimd/franceculture/franceculture +PythonInterpreter platform +PythonOption django.root /~wakimd/platform/platform PythonOption virtualenv.activate_path /iridata/users/wakimd/Env/Efculture/bin/activate_this.py PythonDebug on PythonPath "['/iridata/users/wakimd/Env/Efculture/lib/python2.6/sites-packages'] + sys.path" diff -r bdf22b140727 -r 6a2a816d4ba3 web/platform/.htaccess.mod_wsgi.tmpl --- a/web/platform/.htaccess.mod_wsgi.tmpl Thu Jan 27 18:59:34 2011 +0100 +++ b/web/platform/.htaccess.mod_wsgi.tmpl Fri Jan 28 12:43:49 2011 +0100 @@ -1,7 +1,7 @@ -SetEnv DJANGO_SETTINGS_MODULE franceculture.settings +SetEnv DJANGO_SETTINGS_MODULE platform.settings SetEnv PY_USE_XMLPLUS true -SetEnv PROJECT_PATH /iridata/users/wakimd/hg/franceculture/web +SetEnv PROJECT_PATH /iridata/users/wakimd/hg/platform/web SetEnv PYTHON_PATH /iridata/users/wakimd/Env/Efculture/lib/python2.6/site-packages Options ExecCGI FollowSymLinks @@ -9,11 +9,11 @@ #if defined in global definition #defined with WSGIDaemonProcess -#WSGIProcessGroup franceculture +#WSGIProcessGroup platform RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f -RewriteRule ^(.*)$ /dev/~wakimd/franceculture/franceculture/modwsgi.wsgi/$1 [QSA,PT,L] +RewriteRule ^(.*)$ /dev/~wakimd/platform/platform/modwsgi.wsgi/$1 [QSA,PT,L] Header set Pragma "no-cache" Header set Cache-Control "no-cache" diff -r bdf22b140727 -r 6a2a816d4ba3 web/platform/config.py --- a/web/platform/config.py Thu Jan 27 18:59:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -import os, logging - -SITE_ID = 1 - -BASE_DIR = os.path.dirname(os.path.abspath(__file__)).rstrip("/")+"/" -BASE_URL = '/~ymh/platform/' -WEB_URL = 'http://localhost' -MEDIA_BASE_URL = BASE_URL + 'static/' -STREAM_URL = MEDIA_BASE_URL + "media/content/" - -STREAM_SRC_PREFIX = "" - - - -# Absolute path to the directory that holds media. -# Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = os.path.abspath(BASE_DIR + "../static/") - -# URL that handles the media served from MEDIA_ROOT. Make sure to use a -# trailing slash if there is a path component (optional in other cases). -# Examples: "http://media.lawrence.com", "http://example.com/media/" -MEDIA_URL = MEDIA_BASE_URL - -CONTENT_ROOT = MEDIA_ROOT + "/media/content/" -STREAM_PATH = CONTENT_ROOT - -# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a -# trailing slash. -# Examples: "http://foo.com/media/", "/media/". -ADMIN_MEDIA_PREFIX = MEDIA_URL + 'admin/' -LDT_MEDIA_PREFIX = MEDIA_URL + 'ldt/' - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'platform', # Or path to database file if using sqlite3. - 'USER': 'iri', # Not used with sqlite3. - 'PASSWORD': 'iri', # Not used with sqlite3. - 'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': '5432', # Set to empty string for default. Not used with sqlite3. - } -} - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - -LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../log/log.txt")) -LOG_LEVEL = logging.DEBUG - -INDEX_PATH = os.path.abspath(BASE_DIR + "../index/") - - -ADMINS = ( - # ('Your Name', 'your_email@domain.com'), -) - -MANAGERS = ADMINS - -EMAIL_USE_TLS = True -EMAIL_HOST = 'smtp.gmail.com' -EMAIL_HOST_USER = 'iri.ddc@gmail.com' -EMAIL_HOST_PASSWORD = 'ddciripompidou' -EMAIL_PORT = 587 - -ACCOUNT_ACTIVATION_DAYS = 7 -REGISTRATION_OPEN = False - -LDT_MAX_SEARCH_NUMBER = 50 -LDT_JSON_DEFAULT_INDENT = 2 - -EMPTY_MEDIA_EXTERNALID = "EMPTY" \ No newline at end of file diff -r bdf22b140727 -r 6a2a816d4ba3 web/platform/modwsgi.wsgi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/platform/modwsgi.wsgi Fri Jan 28 12:43:49 2011 +0100 @@ -0,0 +1,25 @@ +import os, sys, site + +def application(environ, start_response): + os.environ['DJANGO_SETTINGS_MODULE'] = environ['DJANGO_SETTINGS_MODULE'] + + prev_sys_path = list(sys.path) + + sys.path.append(environ['PROJECT_PATH']) + for path in environ.get('PYTHON_PATH',"").split(os.pathsep): + if path: + site.addsitedir(path) + + new_sys_path = [] + for item in list(sys.path): + if item not in prev_sys_path: + new_sys_path.append(item) + sys.path.remove(item) + sys.path[:0] = new_sys_path + + import django.core.handlers.wsgi + + _application = django.core.handlers.wsgi.WSGIHandler() + + return _application(environ, start_response) +