This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added files to repo for safe keeping (#49)
Co-authored-by: alan.moss <[email protected]>
- Loading branch information
1 parent
27b52ea
commit dfbdde2
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |