Skip to content

Commit 73fa8a7

Browse files
committed
Fix media root for nginx
1 parent 1e9854b commit 73fa8a7

File tree

6 files changed

+25
-5
lines changed

6 files changed

+25
-5
lines changed

docker/.env.dev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ SECRET_KEY='3!4^11rgx0-53)!n#18(1_^)&pj-3n^Afpc#mbm(+!fj4r$rp7ea!s'
44
CIPHER_KEY_SALT=salt
55
SINGLE_THREAD=False
66
AUTORELOAD=True
7+
DJANGO_MANAGEPY_LOADSTOREAPPS=on
78
ALLOWED_HOSTS=*
89
DATABASE_ENGINE=postgresql
910
DATABASE_NAME=postgres

docker/app/nginx.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ server {
1616
location /static/ {
1717
alias /usr/share/nginx/html/static/;
1818
}
19+
20+
location /media/ {
21+
alias /usr/share/nginx/html/media/;
22+
}
1923

2024
location ~ ^/(api|ws) {
2125
proxy_pass http://llmstack;

docker/docker-compose.dev.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ services:
3737
- .env.dev
3838
depends_on:
3939
- api
40+
volumes:
41+
- userdata:/usr/share/nginx/html/media
4042
redis:
4143
image: redis:latest
4244
ports:

llmstack/cli.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ def prepare_env():
9797

9898
if keep_updated.lower() != "n":
9999
# Add the user to the mailing list
100-
webbrowser.open("https://forms.gle/UKQ9rumczFDvwVmg7")
100+
try:
101+
webbrowser.open("https://forms.gle/UKQ9rumczFDvwVmg7")
102+
except Exception:
103+
print("Failed to open browser. Please open the browser and navigate to the URL below.")
104+
print("https://forms.gle/UKQ9rumczFDvwVmg7")
101105

102106
with open(config_path, "w") as f:
103107
toml.dump(config, f)
@@ -172,7 +176,13 @@ def wait_for_server(llmstack_environment, timeout):
172176
time.sleep(2 + (random.randint(0, 1000) / 1000))
173177
continue
174178

175-
webbrowser.open(f'http://{llmstack_environment["LLMSTACK_HOST"]}:{llmstack_environment["LLMSTACK_PORT"]}')
179+
try:
180+
webbrowser.open(f'http://{llmstack_environment["LLMSTACK_HOST"]}:{llmstack_environment["LLMSTACK_PORT"]}')
181+
except Exception:
182+
print("\nFailed to open browser. Please open the browser and navigate to the URL below.")
183+
print(
184+
f"LLMStack server is running at http://{llmstack_environment['LLMSTACK_HOST']}:{llmstack_environment['LLMSTACK_PORT']}"
185+
)
176186

177187

178188
def print_compose_logs(follow=True, stream=True):
@@ -302,7 +312,7 @@ def signal_handler(sig, frame):
302312
llmstack_environment["TAG"] = args.tag
303313

304314
# Load default store apps
305-
llmstack_environment["DJANGO_MANAGEPY_LOADSTOREAPPS"] = "on"
315+
os.environ["DJANGO_MANAGEPY_LOADSTOREAPPS"] = "on"
306316

307317
start(llmstack_environment)
308318

llmstack/docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ services:
1010
volumes:
1111
- userdata:/home/appuser/data
1212
environment:
13+
DJANGO_MANAGEPY_LOADSTOREAPPS: ${DJANGO_MANAGEPY_LOADSTOREAPPS:-off}
1314
LLMSTACK_PORT: ${LLMSTACK_PORT:-9000}
1415
LLMSTACK_HOST: ${LLMSTACK_HOST:-localhost}
1516
REDIS_HOST: ${REDIS_HOST:-redis}
@@ -72,6 +73,8 @@ services:
7273
- ${LLMSTACK_PORT:-9000}:80
7374
depends_on:
7475
- api
76+
volumes:
77+
- userdata:/usr/share/nginx/html/media
7578
redis:
7679
image: redis:latest
7780
command: redis-server

llmstack/server/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,15 @@
205205
)
206206
ASSETS_URL = os.getenv(
207207
"ASSETS_URL",
208-
"/assets/",
208+
"/media/assets/",
209209
)
210210
PUBLIC_ASSETS_ROOT = os.getenv(
211211
"PUBLIC_ASSETS_ROOT",
212212
"/home/appuser/data/public_assets",
213213
)
214214
PUBLIC_ASSETS_URL = os.getenv(
215215
"PUBLIC_ASSETS_URL",
216-
"/public_assets/",
216+
"/media/public_assets/",
217217
)
218218

219219
STORAGES = {

0 commit comments

Comments
 (0)