実現したいこと
Djangoで作成したWebアプリをreander.comを通じて公開してみたいです。
発生している問題・分からないこと
Webアプリを公開しようとしても502と表示されてしまいます。
DashboradのEventsを確認し、Deploy failed for f02117dと表示されています。
logを確認するとbulid.shに問題があると記載されている。確認してもどのように修正するか不明です。
補足として無料版を使用しています。無料期間中ですので、その点は問題ないと思われます
該当のソースコード
log
12025-06-15T08:15:55.479962137Z ==> Cloning from https://github.com/OKblog/salesprojects 22025-06-15T08:16:00.92222682Z ==> Checking out commit f02117d2f3ff01a884a950edaec38414bd25a422 in branch master 32025-06-15T08:16:03.65416802Z ==> Using Python version 3.13.4 (default) 42025-06-15T08:16:03.680529384Z ==> Docs on specifying a Python version: https://render.com/docs/python-version 52025-06-15T08:16:07.703925108Z ==> Using Poetry version 2.1.3 (default) 62025-06-15T08:16:07.754890748Z ==> Docs on specifying a Poetry version: https://render.com/docs/poetry-version 72025-06-15T08:16:07.765433786Z ==> Running build command './build.sh'... 82025-06-15T08:16:07.768662492Z bash: line 1: ./build.sh: No such file or directory 92025-06-15T08:16:07.768918457Z ==> Build failed 😞 102025-06-15T08:16:07.768932138Z ==> Common ways to troubleshoot your deploy: https://render.com/docs/troubleshooting-deploys
bulid.sh
1set -o errexit 2pip install -r requirements.txt 3python3 manage.py collectstatic --no-input 4python3 manage.py migrate 5python3 manage.py newsuperuser
settings.py
1DEBUG = False 2 3ALLOWED_HOSTS = ['*'] 4MIDDLEWARE = [ 5 "django.middleware.security.SecurityMiddleware", 6 "django.contrib.sessions.middleware.SessionMiddleware", 7 "django.middleware.common.CommonMiddleware", 8 "django.middleware.csrf.CsrfViewMiddleware", 9 "django.contrib.auth.middleware.AuthenticationMiddleware", 10 "django.contrib.messages.middleware.MessageMiddleware", 11 "django.middleware.clickjacking.XFrameOptionsMiddleware", 12 "whitenoise.middleware.WhiteNoiseMiddleware", 13] 14if not DEBUG: 15 DATABASES = { 16 "default": dj_database_url.config ( 17 #Replace this value with your local database's connection string. 18 default = 'postgresql://postgres:postgres@localhost:5432/salesproject', 19 conn_max_age=600 20 ) 21}
render.yaml
1databases: 2 - name: mysitedb 3 plan: free 4 databaseName: sales 5 user: sales 6 7services: 8 - type: web 9 plan: free 10 name: salesproject 11 runtime: python 12 buildCommand: "./build.sh" 13 startCommand: "python -m gunicorn salesproject.asgi:application -k uvicorn.workers.UvicornWorker" 14 envVars: 15 - key: DATABASE_URL 16 fromDatabase: 17 name: mysitedb 18 property: connectionString 19 - key: WEB_CONCURRENCY 20 value: 4
requirements.txt
1asgiref==3.8.1 2Brotli==1.1.0 3click==8.2.1 4colorama==0.4.6 5dj-database-url==3.0.0 6Django==5.1.2 7gunicorn==23.0.0 8h11==0.16.0 9packaging==25.0 10psycopg2-binary==2.9.10 11sqlparse==0.5.3 12typing_extensions==4.14.0 13tzdata==2025.1 14uvicorn==0.34.3 15whitenoise==6.9.0 16
試したこと・調べたこと
- teratailやGoogle等で検索した
- ソースコードを自分なりに変更した
- 知人に聞いた
- その他
上記の詳細・結果
bulid.shの記載方法を修正しましたが、502と表示されたままでした。
補足
特になし
回答1件
あなたの回答
tips
プレビュー