Commit 2d5c3b47 authored by Michal Čihař's avatar Michal Čihař

Share code for virtualenv activation

Use execfile for sharing code as importing module does not work here.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 5acfdbf5
# -*- coding: utf-8 -*-
#
# Copyright © 2014 Daniel Tschan <tschan@puzzle.ch>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import os
virtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/'
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
pass
......@@ -28,11 +28,8 @@ sys.path.append(os.path.join(os.environ['OPENSHIFT_REPO_DIR'], 'openshift'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'weblate.settings_openshift'
virtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/'
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
pass
execfile(os.path.join(
os.environ['OPENSHIFT_REPO_DIR'], 'openshift', 'virtualenv.py'
))
application = get_wsgi_application()
......@@ -22,12 +22,9 @@
import os
from string import Template
virtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/'
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
pass
execfile(os.path.join(
os.environ['OPENSHIFT_REPO_DIR'], 'openshift', 'virtualenv.py'
))
def application(environ, start_response):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment