mirror of
https://github.com/ansible/awx.git
synced 2026-03-18 09:27:31 -02:30
more carefully add to python path
* ensure our path is the first in the sys.path list instead of blindly poping and pushing onto the path
This commit is contained in:
@@ -41,9 +41,14 @@ def prepare_env():
|
|||||||
local_site_packages = os.path.join(os.path.dirname(__file__), 'lib',
|
local_site_packages = os.path.join(os.path.dirname(__file__), 'lib',
|
||||||
'site-packages')
|
'site-packages')
|
||||||
site.addsitedir(local_site_packages)
|
site.addsitedir(local_site_packages)
|
||||||
# Work around https://bugs.python.org/issue7744
|
try:
|
||||||
# by moving local_site_packages to the front of sys.path
|
index = sys.path.index(local_site_packages)
|
||||||
sys.path.insert(0, sys.path.pop())
|
sys.path.pop(index)
|
||||||
|
# Work around https://bugs.python.org/issue7744
|
||||||
|
# by moving local_site_packages to the front of sys.path
|
||||||
|
sys.path.insert(0, local_site_packages)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
# Hide DeprecationWarnings when running in production. Need to first load
|
# Hide DeprecationWarnings when running in production. Need to first load
|
||||||
# settings to apply our filter after Django's own warnings filter.
|
# settings to apply our filter after Django's own warnings filter.
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|||||||
Reference in New Issue
Block a user