Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Added files to repo for safe keeping (#49)
Browse files Browse the repository at this point in the history
Co-authored-by: alan.moss <[email protected]>
  • Loading branch information
mpolidori and amossCivicA authored Sep 6, 2022
1 parent 27b52ea commit dfbdde2
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
36 changes: 36 additions & 0 deletions ckan/activate_this.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""By using execfile(this_file, dict(__file__=this_file)) you will
activate this virtualenv environment.
This can be used when you must use an existing Python interpreter, not
the virtualenv bin/python
"""

try:
__file__
except NameError:
raise AssertionError(
"You must run this like execfile('path/to/activate_this.py', dict(__fil e__='path/to/activate_this.py'))")
import sys
import os

old_os_path = os.environ.get('PATH', '')
os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + os.pathsep +
old_os_path
base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if sys.platform == 'win32':
site_packages = os.path.join(base, 'Lib', 'site-packages')
else:
site_packages = os.path.join(base, 'lib', 'python%s' % sys.version[:3], 'site-packages')
prev_sys_path = list(sys.path)
import site
site.addsitedir(site_packages)
sys.real_prefix = sys.prefix
sys.prefix = base
# Move the added items to the front of the 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
25 changes: 25 additions & 0 deletions ckan/apache.wsgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# -*- coding: utf-8 -*-

import sys
import logging
logging.error(sys.getfilesystemencoding())
logging.error('Hello World from apache.wsgi --------------')

import os
activator = os.path.join('/usr/lib/ckan/default/bin/activate_this.py')
with open(activator) as f:
exec(f.read(), {'__file__': activator})
from ckan.config.middleware import make_app
from ckan.cli import CKANConfigLoader
from logging.config import fileConfig as loggingFileConfig
if os.environ.get(u'CKAN_INI'):
config_path = os.environ[u'CKAN_INI']
else:
config_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), u'ckan.ini')
if not os.path.exists(config_path):
raise RuntimeError(u'CKAN config option not found: {}'.format(config_path))
loggingFileConfig(config_path)
config = CKANConfigLoader(config_path).get_config()
application = make_app(config)

0 comments on commit dfbdde2

Please sign in to comment.