mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-27 15:58:06 -05:00
Fix STATIC_ROOT determination for standalone js.py usage.
Also, remove import-time dependency on pylons.g.
This commit is contained in:
@@ -7,10 +7,15 @@ import json
|
||||
|
||||
from r2.lib.translation import iter_langs
|
||||
|
||||
if __name__ != "__main__":
|
||||
from pylons import g, c
|
||||
STATIC_ROOT = g.paths["static_files"]
|
||||
try:
|
||||
from pylons import g, c, config
|
||||
except ImportError:
|
||||
STATIC_ROOT = None
|
||||
else:
|
||||
STATIC_ROOT = config["pylons.paths"]["static_files"]
|
||||
|
||||
# STATIC_ROOT will be None if pylons is uninitialized
|
||||
if not STATIC_ROOT:
|
||||
REDDIT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
STATIC_ROOT = os.path.join(REDDIT_ROOT, "public")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user