hatamo commited on
Commit
ede3ebe
·
1 Parent(s): dc16985

Added some local path fixes v2

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -0
  2. app.py +2 -7
Dockerfile CHANGED
@@ -31,6 +31,7 @@ EXPOSE 7860
31
 
32
  # Set environment variables
33
  ENV PYTHONUNBUFFERED=1
 
34
 
35
  # Run the app
36
  CMD ["python", "app.py"]
 
31
 
32
  # Set environment variables
33
  ENV PYTHONUNBUFFERED=1
34
+ ENV PYTHONPATH=/app/code
35
 
36
  # Run the app
37
  CMD ["python", "app.py"]
app.py CHANGED
@@ -18,13 +18,8 @@ spec = importlib.util.spec_from_file_location("antique_auth_code_app", app_path)
18
  module = importlib.util.module_from_spec(spec)
19
  spec.loader.exec_module(module)
20
 
21
- # Optionally: remove CODE_DIR from sys.path after loading to avoid side effects
22
- try:
23
- # remove the first occurrence we added
24
- if sys.path[0] == CODE_DIR:
25
- sys.path.pop(0)
26
- except Exception:
27
- pass
28
 
29
  # The FastAPI `app` object expected inside code/app.py
30
  app = getattr(module, "app")
 
18
  module = importlib.util.module_from_spec(spec)
19
  spec.loader.exec_module(module)
20
 
21
+ # Keep CODE_DIR on sys.path so request-time imports inside `code/app.py`
22
+ # (e.g. `from web_scraper_allegro import ...`) continue to work.
 
 
 
 
 
23
 
24
  # The FastAPI `app` object expected inside code/app.py
25
  app = getattr(module, "app")