virtenv = PY_DIR + '/virtenv/'

PY_CACHE = os.path.join(virtenv, 'lib', PY_VERSION, 'site-packages')

os.environ['PYTHON_EGG_CACHE'] = os.path.join(PY_CACHE)
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')

try:
    execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
    pass

# Instance configurations
DB_NAME = os.environ['OPENSHIFT_APP_NAME']
if len(DB_NAME.strip()) == 0:
    DB_NAME = 'victimsweb'
os.environ['VICTIMS_DB_NAME'] = DB_NAME
config_file = os.path.join(
    os.environ['OPENSHIFT_DATA_DIR'], 'victimsweb.cfg')
if not os.path.exists(config_file):
    config_file = os.path.join(
        os.environ['OPENSHIFT_REPO_DIR'], 'config', 'victimsweb.cfg')
os.environ['VICTIMS_CONFIG'] = config_file
os.environ['VICTIMS_LOG_DIR'] = os.environ['OPENSHIFT_PYTHON_LOG_DIR']

# Start the application
from victims_web.application import app as application
application.run(host=os.environ['OPENSHIFT_PYTHON_IP'],
                port=int(os.environ['OPENSHIFT_PYTHON_PORT']))
virtenv = PY_DIR + '/virtenv/'

PY_CACHE = os.path.join(virtenv, 'lib', PY_VERSION, 'site-packages')

os.environ['PYTHON_EGG_CACHE'] = os.path.join(PY_CACHE)
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')

try:
    execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
    pass

# Instance configurations
DB_NAME = os.environ['OPENSHIFT_APP_NAME']
if len(DB_NAME.strip()) == 0:
    DB_NAME = 'victimsweb'
os.environ['VICTIMS_DB_NAME'] = DB_NAME
config_file = os.path.join(os.environ['OPENSHIFT_DATA_DIR'], 'victimsweb.cfg')
if not os.path.exists(config_file):
    config_file = os.path.join(os.environ['OPENSHIFT_REPO_DIR'], 'config',
                               'victimsweb.cfg')
os.environ['VICTIMS_CONFIG'] = config_file
os.environ['VICTIMS_LOG_DIR'] = os.environ['OPENSHIFT_PYTHON_LOG_DIR']

# Start the application
from victims_web.application import app as application

application.run(host=os.environ['OPENSHIFT_PYTHON_IP'],
                port=int(os.environ['OPENSHIFT_PYTHON_PORT']))
Example #3
0
# This file is part of victims-web.
#
# Copyright (C) 2013 The Victims Project
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero 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 Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
The victims-web module.
"""

if __name__ == '__main__':
    from victims_web.application import app
    # If we are called locally run with debug on
    app.run(debug=True)