lando / lando/python

Unable to get Django up and running

Đang mở
#27 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Needs Triage
Ngôn ngữ chính
JavaScript
Star
3
Fork
1
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

---
name: django-play
services:
  appserver:
    type: python:3.11
    build:
      - pip install --upgrade pip
      - pip install -r requirements.txt
    scanner: true
    # NOTE: this entire Landofile hard codes a path to a project we assume exists. If you have a different
    # name for your project, you'll have to change all occurences of 'firstapp' to whatever your project is named.
    command: python /app/airlineclub/manage.py runserver 0:8800
    overrides:
      ports:
        - "8000:8000"
      environment:
        # NOTE: change this path to match your project name
        PYTHONPATH: "/app/airlineclub"
        DJANGO_SETTINGS_MODULE: "firstapp.settings"
    moreHttpPorts:
      - "8000"
  db:
    # NOTE: the credentials below are the default for Lando, don't bother trying to change them
    type: postgres:15
    portforward: true
    creds:
      user: postgres
      password:
      database: django-play

tooling:
  django-admin:
    service: appserver
    cmd: django-admin
  python:
    service: appserver
    cmd: python
  pip:
    service: appserver
    cmd: pip
  manage:
    service: appserver
    # NOTE: change this path to match your project name
    cmd: cd /app/airlineclub && python /app/airlineclub/manage.py
  psql:
    service: db
    cmd: psql -U postgres
  "db-import <file>":
    service: :host
    description: Imports a dump file into a database service
    cmd: /helpers/sql-import.sh
    options:
      host:
        description: The database service to use
        default: db
        alias:
          - h
      no-wipe:
        description: Do not destroy the existing database before an import
        boolean: true

results in:

appserver_1  | 2023-10-14T08:28:05.489931858Z lando 08:28:05.48 INFO  ==> Lando handing off to: /bin/sh -c python /app/airlineclub/manage.py runserver 0:8800
appserver_1  | 2023-10-14T08:28:05.508377347Z Traceback (most recent call last):
appserver_1  | 2023-10-14T08:28:05.508414138Z   File "/app/airlineclub/manage.py", line 10, in main
appserver_1  | 2023-10-14T08:28:05.508421998Z     from django.core.management import execute_from_command_line
appserver_1  | 2023-10-14T08:28:05.508428058Z ModuleNotFoundError: No module named 'django'
appserver_1  | 2023-10-14T08:28:05.508433998Z 
appserver_1  | 2023-10-14T08:28:05.508440028Z The above exception was the direct cause of the following exception:
appserver_1  | 2023-10-14T08:28:05.508445958Z 
appserver_1  | 2023-10-14T08:28:05.508451679Z Traceback (most recent call last):
appserver_1  | 2023-10-14T08:28:05.508461699Z   File "/app/airlineclub/manage.py", line 21, in <module>
appserver_1  | 2023-10-14T08:28:05.508468019Z     main()
appserver_1  | 2023-10-14T08:28:05.508473529Z   File "/app/airlineclub/manage.py", line 12, in main
appserver_1  | 2023-10-14T08:28:05.508495950Z     raise ImportError(
appserver_1  | 2023-10-14T08:28:05.508502380Z ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?

It appears that the build command isn't running before the command. What am I missing?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với Landofile, requirements.txt và /app/airlineclub/manage.py, sau đó tái hiện quá trình khởi động appserver như đã nêu và kiểm tra xem các bước build có chạy trước lệnh hay không. Công việc được xem là hoàn tất khi service đã cấu hình có thể import Django và khởi động manage.py runserver mà không gặp ModuleNotFoundError đã báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
django, postgresql, python
Lĩnh vực
backend, databases, devops
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.